summaryrefslogtreecommitdiff
path: root/boost/unordered/unordered_set.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:05:34 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:06:28 +0900
commit34bd32e225e2a8a94104489b31c42e5801cc1f4a (patch)
treed021b579a0c190354819974e1eaf0baa54b551f3 /boost/unordered/unordered_set.hpp
parentf763a99a501650eff2c60288aa6f10ef916d769e (diff)
downloadboost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.gz
boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.tar.bz2
boost-34bd32e225e2a8a94104489b31c42e5801cc1f4a.zip
Imported Upstream version 1.63.0upstream/1.63.0
Change-Id: Iac85556a04b7e58d63ba636dedb0986e3555714a Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/unordered/unordered_set.hpp')
-rw-r--r--boost/unordered/unordered_set.hpp302
1 files changed, 247 insertions, 55 deletions
diff --git a/boost/unordered/unordered_set.hpp b/boost/unordered/unordered_set.hpp
index c8c062152e..77cd87e0fd 100644
--- a/boost/unordered/unordered_set.hpp
+++ b/boost/unordered/unordered_set.hpp
@@ -67,9 +67,9 @@ namespace unordered
typedef std::ptrdiff_t difference_type;
typedef typename table::cl_iterator const_local_iterator;
- typedef typename table::cl_iterator local_iterator;
+ typedef typename table::l_iterator local_iterator;
typedef typename table::c_iterator const_iterator;
- typedef typename table::c_iterator iterator;
+ typedef typename table::iterator iterator;
private:
@@ -79,12 +79,23 @@ namespace unordered
// constructors
+ unordered_set();
+
explicit unordered_set(
- size_type = boost::unordered::detail::default_bucket_count,
+ size_type,
const hasher& = hasher(),
const key_equal& = key_equal(),
const allocator_type& = allocator_type());
+ explicit unordered_set(
+ size_type,
+ const allocator_type&);
+
+ explicit unordered_set(
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
explicit unordered_set(allocator_type const&);
template <class InputIt>
@@ -105,11 +116,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template <class InputIt>
+ unordered_set(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template <class InputIt>
+ unordered_set(
+ InputIt, InputIt,
+ size_type,
+ const allocator_type&);
+
// copy/move constructors
unordered_set(unordered_set const&);
unordered_set(unordered_set const&, allocator_type const&);
+ unordered_set(BOOST_RV_REF(unordered_set), allocator_type const&);
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_set(BOOST_RV_REF(unordered_set) other)
@@ -125,10 +150,6 @@ namespace unordered
}
#endif
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- unordered_set(unordered_set&&, allocator_type const&);
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_set(
std::initializer_list<value_type>,
@@ -136,6 +157,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_set(
+ std::initializer_list<value_type>,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_set(
+ std::initializer_list<value_type>,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -199,12 +229,12 @@ namespace unordered
iterator begin() BOOST_NOEXCEPT
{
- return table_.begin();
+ return iterator(table_.begin());
}
const_iterator begin() const BOOST_NOEXCEPT
{
- return table_.begin();
+ return const_iterator(table_.begin());
}
iterator end() BOOST_NOEXCEPT
@@ -219,7 +249,7 @@ namespace unordered
const_iterator cbegin() const BOOST_NOEXCEPT
{
- return table_.begin();
+ return const_iterator(table_.begin());
}
const_iterator cend() const BOOST_NOEXCEPT
@@ -237,9 +267,9 @@ namespace unordered
}
template <class... Args>
- iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
+ iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
- return table_.emplace(boost::forward<Args>(args)...).first;
+ return table_.emplace_hint(hint, boost::forward<Args>(args)...);
}
#else
@@ -278,12 +308,12 @@ namespace unordered
}
template <typename A0>
- iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
+ iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0))
- ).first;
+ );
}
template <typename A0, typename A1>
@@ -299,15 +329,15 @@ namespace unordered
}
template <typename A0, typename A1>
- iterator emplace_hint(const_iterator,
+ iterator emplace_hint(const_iterator hint,
BOOST_FWD_REF(A0) a0,
BOOST_FWD_REF(A1) a1)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0),
boost::forward<A1>(a1))
- ).first;
+ );
}
template <typename A0, typename A1, typename A2>
@@ -325,17 +355,17 @@ namespace unordered
}
template <typename A0, typename A1, typename A2>
- iterator emplace_hint(const_iterator,
+ iterator emplace_hint(const_iterator hint,
BOOST_FWD_REF(A0) a0,
BOOST_FWD_REF(A1) a1,
BOOST_FWD_REF(A2) a2)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0),
boost::forward<A1>(a1),
boost::forward<A2>(a2))
- ).first;
+ );
}
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
@@ -357,15 +387,15 @@ namespace unordered
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
> \
iterator emplace_hint( \
- const_iterator, \
+ const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return table_.emplace( \
+ return table_.emplace_hint(hint, \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
- )).first; \
+ )); \
}
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
@@ -536,9 +566,9 @@ namespace unordered
typedef std::ptrdiff_t difference_type;
typedef typename table::cl_iterator const_local_iterator;
- typedef typename table::cl_iterator local_iterator;
+ typedef typename table::l_iterator local_iterator;
typedef typename table::c_iterator const_iterator;
- typedef typename table::c_iterator iterator;
+ typedef typename table::iterator iterator;
private:
@@ -548,12 +578,23 @@ namespace unordered
// constructors
+ unordered_multiset();
+
explicit unordered_multiset(
- size_type = boost::unordered::detail::default_bucket_count,
+ size_type,
const hasher& = hasher(),
const key_equal& = key_equal(),
const allocator_type& = allocator_type());
+ explicit unordered_multiset(
+ size_type,
+ const allocator_type&);
+
+ explicit unordered_multiset(
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
explicit unordered_multiset(allocator_type const&);
template <class InputIt>
@@ -574,11 +615,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template <class InputIt>
+ unordered_multiset(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template <class InputIt>
+ unordered_multiset(
+ InputIt, InputIt,
+ size_type,
+ const allocator_type&);
+
// copy/move constructors
unordered_multiset(unordered_multiset const&);
unordered_multiset(unordered_multiset const&, allocator_type const&);
+ unordered_multiset(BOOST_RV_REF(unordered_multiset), allocator_type const&);
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multiset(BOOST_RV_REF(unordered_multiset) other)
@@ -594,10 +649,6 @@ namespace unordered
}
#endif
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- unordered_multiset(unordered_multiset&&, allocator_type const&);
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multiset(
std::initializer_list<value_type>,
@@ -605,6 +656,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_multiset(
+ std::initializer_list<value_type>,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_multiset(
+ std::initializer_list<value_type>,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -707,9 +767,9 @@ namespace unordered
}
template <class... Args>
- iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
+ iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
- return table_.emplace(boost::forward<Args>(args)...);
+ return table_.emplace_hint(hint, boost::forward<Args>(args)...);
}
#else
@@ -748,9 +808,9 @@ namespace unordered
}
template <typename A0>
- iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
+ iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0))
);
@@ -769,11 +829,11 @@ namespace unordered
}
template <typename A0, typename A1>
- iterator emplace_hint(const_iterator,
+ iterator emplace_hint(const_iterator hint,
BOOST_FWD_REF(A0) a0,
BOOST_FWD_REF(A1) a1)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0),
boost::forward<A1>(a1))
@@ -795,12 +855,12 @@ namespace unordered
}
template <typename A0, typename A1, typename A2>
- iterator emplace_hint(const_iterator,
+ iterator emplace_hint(const_iterator hint,
BOOST_FWD_REF(A0) a0,
BOOST_FWD_REF(A1) a1,
BOOST_FWD_REF(A2) a2)
{
- return table_.emplace(
+ return table_.emplace_hint(hint,
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0),
boost::forward<A1>(a1),
@@ -827,11 +887,11 @@ namespace unordered
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
> \
iterator emplace_hint( \
- const_iterator, \
+ const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return table_.emplace( \
+ return table_.emplace_hint(hint, \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
@@ -977,6 +1037,13 @@ namespace unordered
////////////////////////////////////////////////////////////////////////////////
template <class T, class H, class P, class A>
+ unordered_set<T,H,P,A>::unordered_set()
+ : table_(boost::unordered::detail::default_bucket_count, hasher(),
+ key_equal(), allocator_type())
+ {
+ }
+
+ template <class T, class H, class P, class A>
unordered_set<T,H,P,A>::unordered_set(
size_type n, const hasher &hf, const key_equal &eql,
const allocator_type &a)
@@ -985,6 +1052,20 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ unordered_set<T,H,P,A>::unordered_set(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template <class T, class H, class P, class A>
+ unordered_set<T,H,P,A>::unordered_set(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
+ template <class T, class H, class P, class A>
unordered_set<T,H,P,A>::unordered_set(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
hasher(), key_equal(), a)
@@ -1034,6 +1115,31 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ template <class InputIt>
+ unordered_set<T,H,P,A>::unordered_set(
+ InputIt f, InputIt l,
+ size_type n,
+ const hasher &hf,
+ const allocator_type &a)
+ : table_(boost::unordered::detail::initial_size(f, l, n),
+ hf, key_equal(), a)
+ {
+ table_.insert_range(f, l);
+ }
+
+ template <class T, class H, class P, class A>
+ template <class InputIt>
+ unordered_set<T,H,P,A>::unordered_set(
+ InputIt f, InputIt l,
+ size_type n,
+ const allocator_type &a)
+ : table_(boost::unordered::detail::initial_size(f, l, n),
+ hasher(), key_equal(), a)
+ {
+ table_.insert_range(f, l);
+ }
+
+ template <class T, class H, class P, class A>
unordered_set<T,H,P,A>::~unordered_set() BOOST_NOEXCEPT {}
template <class T, class H, class P, class A>
@@ -1043,17 +1149,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template <class T, class H, class P, class A>
unordered_set<T,H,P,A>::unordered_set(
- unordered_set&& other, allocator_type const& a)
+ BOOST_RV_REF(unordered_set) other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
}
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
@@ -1069,6 +1171,30 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ unordered_set<T,H,P,A>::unordered_set(
+ std::initializer_list<value_type> list, size_type n,
+ const hasher &hf, const allocator_type &a)
+ : table_(
+ boost::unordered::detail::initial_size(
+ list.begin(), list.end(), n),
+ hf, key_equal(), a)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+
+ template <class T, class H, class P, class A>
+ unordered_set<T,H,P,A>::unordered_set(
+ std::initializer_list<value_type> list, size_type n,
+ const allocator_type &a)
+ : table_(
+ boost::unordered::detail::initial_size(
+ list.begin(), list.end(), n),
+ hasher(), key_equal(), a)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+
+ template <class T, class H, class P, class A>
unordered_set<T,H,P,A>& unordered_set<T,H,P,A>::operator=(
std::initializer_list<value_type> list)
{
@@ -1161,7 +1287,7 @@ namespace unordered
typename unordered_set<T,H,P,A>::const_iterator
unordered_set<T,H,P,A>::find(const key_type& k) const
{
- return table_.find_node(k);
+ return const_iterator(table_.find_node(k));
}
template <class T, class H, class P, class A>
@@ -1173,7 +1299,7 @@ namespace unordered
CompatibleHash const& hash,
CompatiblePredicate const& eq) const
{
- return table_.generic_find_node(k, hash, eq);
+ return const_iterator(table_.generic_find_node(k, hash, eq));
}
template <class T, class H, class P, class A>
@@ -1261,6 +1387,13 @@ namespace unordered
////////////////////////////////////////////////////////////////////////////////
template <class T, class H, class P, class A>
+ unordered_multiset<T,H,P,A>::unordered_multiset()
+ : table_(boost::unordered::detail::default_bucket_count, hasher(),
+ key_equal(), allocator_type())
+ {
+ }
+
+ template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>::unordered_multiset(
size_type n, const hasher &hf, const key_equal &eql,
const allocator_type &a)
@@ -1269,6 +1402,20 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template <class T, class H, class P, class A>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
+ template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>::unordered_multiset(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
hasher(), key_equal(), a)
@@ -1318,6 +1465,31 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ template <class InputIt>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ InputIt f, InputIt l,
+ size_type n,
+ const hasher &hf,
+ const allocator_type &a)
+ : table_(boost::unordered::detail::initial_size(f, l, n),
+ hf, key_equal(), a)
+ {
+ table_.insert_range(f, l);
+ }
+
+ template <class T, class H, class P, class A>
+ template <class InputIt>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ InputIt f, InputIt l,
+ size_type n,
+ const allocator_type &a)
+ : table_(boost::unordered::detail::initial_size(f, l, n),
+ hasher(), key_equal(), a)
+ {
+ table_.insert_range(f, l);
+ }
+
+ template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>::~unordered_multiset() BOOST_NOEXCEPT {}
template <class T, class H, class P, class A>
@@ -1327,17 +1499,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>::unordered_multiset(
- unordered_multiset&& other, allocator_type const& a)
+ BOOST_RV_REF(unordered_multiset) other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
}
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
@@ -1353,6 +1521,30 @@ namespace unordered
}
template <class T, class H, class P, class A>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ std::initializer_list<value_type> list, size_type n,
+ const hasher &hf, const allocator_type &a)
+ : table_(
+ boost::unordered::detail::initial_size(
+ list.begin(), list.end(), n),
+ hf, key_equal(), a)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+
+ template <class T, class H, class P, class A>
+ unordered_multiset<T,H,P,A>::unordered_multiset(
+ std::initializer_list<value_type> list, size_type n,
+ const allocator_type &a)
+ : table_(
+ boost::unordered::detail::initial_size(
+ list.begin(), list.end(), n),
+ hasher(), key_equal(), a)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+
+ template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>& unordered_multiset<T,H,P,A>::operator=(
std::initializer_list<value_type> list)
{
@@ -1445,7 +1637,7 @@ namespace unordered
typename unordered_multiset<T,H,P,A>::const_iterator
unordered_multiset<T,H,P,A>::find(const key_type& k) const
{
- return table_.find_node(k);
+ return const_iterator(table_.find_node(k));
}
template <class T, class H, class P, class A>
@@ -1457,7 +1649,7 @@ namespace unordered
CompatibleHash const& hash,
CompatiblePredicate const& eq) const
{
- return table_.generic_find_node(k, hash, eq);
+ return const_iterator(table_.generic_find_node(k, hash, eq));
}
template <class T, class H, class P, class A>