diff --git a/doc/changes.qbk b/doc/changes.qbk
index 1ac6e023..0353e292 100644
--- a/doc/changes.qbk
+++ b/doc/changes.qbk
@@ -295,5 +295,6 @@ C++11 support has resulted in some breaking changes:
* Various reference documentation improvements.
* Better allocator support ([ticket 12459]).
* Make the no argument constructors implicit.
+* Implement missing allocator aware constructors.
[endsect]
diff --git a/doc/ref.php b/doc/ref.php
index bd16992c..3847ede3 100644
--- a/doc/ref.php
+++ b/doc/ref.php
@@ -258,7 +258,12 @@ EOL;
allocator_type()
- Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
If the defaults are used, hasher, key_equal and
@@ -322,6 +327,168 @@ EOL;
Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.
+
+
+ &&
+
+
+ Allocator const&
+
+
+ Construct a container moving x's contained elements, and having the hash function, predicate and maximum load factor, but using allocate a.
+
+
+ This is implemented using Boost.Move.
+
+
+
+ value_type is move insertable.
+
+
+
+
+
+ initializer_list<value_type>
+
+
+ size_type
+ implementation-defined
+
+
+ hasher const&
+ hasher()
+
+
+ key_equal const&
+ key_equal()
+
+
+ allocator_type const&
+ allocator_type()
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from il into it.
+
+
+
+ If the defaults are used, hasher, key_equal and
+ allocator_type need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default hash function and key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ hasher and key_equal need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using a as the allocator, with the
+ default hash function and key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ hasher, key_equal need to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ a as the allocator, with the
+ default key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
The destructor is applied to every element, and all memory is deallocated
diff --git a/doc/ref.xml b/doc/ref.xml
index 73ec2920..dc22aace 100644
--- a/doc/ref.xml
+++ b/doc/ref.xml
@@ -199,7 +199,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
allocator_type()
- Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
If the defaults are used, hasher, key_equal and
@@ -263,6 +268,168 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.
+
+
+ unordered_set &&
+
+
+ Allocator const&
+
+
+ Construct a container moving x's contained elements, and having the hash function, predicate and maximum load factor, but using allocate a.
+
+
+ This is implemented using Boost.Move.
+
+
+
+ value_type is move insertable.
+
+
+
+
+
+ initializer_list<value_type>
+
+
+ size_type
+ implementation-defined
+
+
+ hasher const&
+ hasher()
+
+
+ key_equal const&
+ key_equal()
+
+
+ allocator_type const&
+ allocator_type()
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from il into it.
+
+
+
+ If the defaults are used, hasher, key_equal and
+ allocator_type need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default hash function and key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ hasher and key_equal need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using a as the allocator, with the
+ default hash function and key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ hasher, key_equal need to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ a as the allocator, with the
+ default key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
The destructor is applied to every element, and all memory is deallocated
@@ -1285,7 +1452,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
allocator_type()
- Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
If the defaults are used, hasher, key_equal and
@@ -1349,6 +1521,168 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.
+
+
+ unordered_multiset &&
+
+
+ Allocator const&
+
+
+ Construct a container moving x's contained elements, and having the hash function, predicate and maximum load factor, but using allocate a.
+
+
+ This is implemented using Boost.Move.
+
+
+
+ value_type is move insertable.
+
+
+
+
+
+ initializer_list<value_type>
+
+
+ size_type
+ implementation-defined
+
+
+ hasher const&
+ hasher()
+
+
+ key_equal const&
+ key_equal()
+
+
+ allocator_type const&
+ allocator_type()
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from il into it.
+
+
+
+ If the defaults are used, hasher, key_equal and
+ allocator_type need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default hash function and key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ hasher and key_equal need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using a as the allocator, with the
+ default hash function and key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ hasher, key_equal need to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ a as the allocator, with the
+ default key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
The destructor is applied to every element, and all memory is deallocated
@@ -2327,6 +2661,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
size_type
+ implementation-defined
hasher const&
@@ -2380,7 +2715,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
allocator_type()
- Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
If the defaults are used, hasher, key_equal and
@@ -2444,6 +2784,167 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.
+
+
+ unordered_map &&
+
+
+ Allocator const&
+
+
+ Construct a container moving x's contained elements, and having the hash function, predicate and maximum load factor, but using allocate a.
+
+
+ This is implemented using Boost.Move.
+
+
+
+ value_type is move insertable.
+
+
+
+
+
+ initializer_list<value_type>
+
+
+ size_type
+
+
+ hasher const&
+ hasher()
+
+
+ key_equal const&
+ key_equal()
+
+
+ allocator_type const&
+ allocator_type()
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from il into it.
+
+
+
+ If the defaults are used, hasher, key_equal and
+ allocator_type need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default hash function and key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ hasher and key_equal need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using a as the allocator, with the
+ default hash function and key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ hasher, key_equal need to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ a as the allocator, with the
+ default key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
The destructor is applied to every element, and all memory is deallocated
@@ -3513,7 +4014,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
allocator_type()
- Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
If the defaults are used, hasher, key_equal and
@@ -3577,6 +4083,168 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.
+
+
+ unordered_multimap &&
+
+
+ Allocator const&
+
+
+ Construct a container moving x's contained elements, and having the hash function, predicate and maximum load factor, but using allocate a.
+
+
+ This is implemented using Boost.Move.
+
+
+
+ value_type is move insertable.
+
+
+
+
+
+ initializer_list<value_type>
+
+
+ size_type
+ implementation-defined
+
+
+ hasher const&
+ hasher()
+
+
+ key_equal const&
+ key_equal()
+
+
+ allocator_type const&
+ allocator_type()
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ eq as the key equality predicate,
+ a as the allocator and a maximum load factor of 1.0
+ and inserts the elements from il into it.
+
+
+
+ If the defaults are used, hasher, key_equal and
+ allocator_type need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default hash function and key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ hasher and key_equal need to be DefaultConstructible.
+
+
+
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ size() == 0
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ the default key equality predicate,
+ a as the allocator and a maximum load factor of 1.0.
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using a as the allocator, with the
+ default hash function and key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ hasher, key_equal need to be DefaultConstructible.
+
+
+
+
+
+
+
+
+
+ InputIterator
+
+
+ InputIterator
+
+
+ size_type
+
+
+ hasher const&
+
+
+ allocator_type const&
+
+
+ Constructs an empty container with at least n buckets,
+ using hf as the hash function,
+ a as the allocator, with the
+ default key equality predicate
+ and a maximum load factor of 1.0
+ and inserts the elements from [f, l) into it.
+
+
+
+ key_equal needs to be DefaultConstructible.
+
+
+
The destructor is applied to every element, and all memory is deallocated
diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp
index 88108363..101b1c1c 100644
--- a/include/boost/unordered/unordered_map.hpp
+++ b/include/boost/unordered/unordered_map.hpp
@@ -90,6 +90,15 @@ namespace unordered
const key_equal& = key_equal(),
const allocator_type& = allocator_type());
+ explicit unordered_map(
+ size_type,
+ const allocator_type&);
+
+ explicit unordered_map(
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
explicit unordered_map(allocator_type const&);
template
@@ -110,11 +119,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template
+ unordered_map(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template
+ unordered_map(
+ InputIt, InputIt,
+ size_type,
+ const allocator_type&);
+
// copy/move constructors
unordered_map(unordered_map const&);
unordered_map(unordered_map const&, allocator_type const&);
+ unordered_map(BOOST_RV_REF(unordered_map), allocator_type const&);
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_map(BOOST_RV_REF(unordered_map) other)
@@ -130,10 +153,6 @@ namespace unordered
}
#endif
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- unordered_map(unordered_map&&, allocator_type const&);
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_map(
std::initializer_list,
@@ -141,6 +160,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_map(
+ std::initializer_list,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_map(
+ std::initializer_list,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -568,12 +596,22 @@ namespace unordered
// constructors
unordered_multimap();
+
explicit unordered_multimap(
size_type,
const hasher& = hasher(),
const key_equal& = key_equal(),
const allocator_type& = allocator_type());
+ explicit unordered_multimap(
+ size_type,
+ const allocator_type&);
+
+ explicit unordered_multimap(
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
explicit unordered_multimap(allocator_type const&);
template
@@ -594,11 +632,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template
+ unordered_multimap(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template
+ unordered_multimap(
+ InputIt, InputIt,
+ size_type,
+ const allocator_type&);
+
// copy/move constructors
unordered_multimap(unordered_multimap const&);
unordered_multimap(unordered_multimap const&, allocator_type const&);
+ unordered_multimap(BOOST_RV_REF(unordered_multimap), allocator_type const&);
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multimap(BOOST_RV_REF(unordered_multimap) other)
@@ -614,10 +666,6 @@ namespace unordered
}
#endif
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- unordered_multimap(unordered_multimap&&, allocator_type const&);
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multimap(
std::initializer_list,
@@ -625,6 +673,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_multimap(
+ std::initializer_list,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_multimap(
+ std::initializer_list,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -1020,6 +1077,20 @@ namespace unordered
{
}
+ template
+ unordered_map::unordered_map(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template
+ unordered_map::unordered_map(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
template
unordered_map::unordered_map(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
@@ -1069,6 +1140,31 @@ namespace unordered
table_.insert_range(f, l);
}
+ template
+ template
+ unordered_map::unordered_map(
+ 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
+ template
+ unordered_map::unordered_map(
+ 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
unordered_map::~unordered_map() BOOST_NOEXCEPT {}
@@ -1079,17 +1175,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template
unordered_map::unordered_map(
- unordered_map&& other, allocator_type const& a)
+ BOOST_RV_REF(unordered_map) other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
}
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template
@@ -1104,6 +1196,30 @@ namespace unordered
table_.insert_range(list.begin(), list.end());
}
+ template
+ unordered_map::unordered_map(
+ std::initializer_list 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
+ unordered_map::unordered_map(
+ std::initializer_list 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
unordered_map& unordered_map::operator=(
std::initializer_list list)
@@ -1360,6 +1476,20 @@ namespace unordered
{
}
+ template
+ unordered_multimap::unordered_multimap(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template
+ unordered_multimap::unordered_multimap(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
template
unordered_multimap::unordered_multimap(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
@@ -1409,6 +1539,31 @@ namespace unordered
table_.insert_range(f, l);
}
+ template
+ template
+ unordered_multimap::unordered_multimap(
+ 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
+ template
+ unordered_multimap::unordered_multimap(
+ 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
unordered_multimap::~unordered_multimap() BOOST_NOEXCEPT {}
@@ -1419,17 +1574,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template
unordered_multimap::unordered_multimap(
- unordered_multimap&& other, allocator_type const& a)
+ BOOST_RV_REF(unordered_multimap) other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
}
-#endif
-
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template
@@ -1444,6 +1595,30 @@ namespace unordered
table_.insert_range(list.begin(), list.end());
}
+ template
+ unordered_multimap::unordered_multimap(
+ std::initializer_list 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
+ unordered_multimap::unordered_multimap(
+ std::initializer_list 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
unordered_multimap& unordered_multimap::operator=(
std::initializer_list list)
diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp
index 42c30bc9..77cd87e0 100644
--- a/include/boost/unordered/unordered_set.hpp
+++ b/include/boost/unordered/unordered_set.hpp
@@ -80,12 +80,22 @@ namespace unordered
// constructors
unordered_set();
+
explicit unordered_set(
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
@@ -106,11 +116,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template
+ unordered_set(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template
+ 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)
@@ -126,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,
@@ -137,6 +157,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_set(
+ std::initializer_list,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_set(
+ std::initializer_list,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -550,12 +579,22 @@ namespace unordered
// constructors
unordered_multiset();
+
explicit unordered_multiset(
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
@@ -576,11 +615,25 @@ namespace unordered
const key_equal&,
const allocator_type&);
+ template
+ unordered_multiset(
+ InputIt, InputIt,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+
+ template
+ 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)
@@ -596,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,
@@ -607,6 +656,15 @@ namespace unordered
const hasher& = hasher(),
const key_equal&l = key_equal(),
const allocator_type& = allocator_type());
+ unordered_multiset(
+ std::initializer_list,
+ size_type,
+ const hasher&,
+ const allocator_type&);
+ unordered_multiset(
+ std::initializer_list,
+ size_type,
+ const allocator_type&);
#endif
// Destructor
@@ -993,6 +1051,20 @@ namespace unordered
{
}
+ template
+ unordered_set::unordered_set(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template
+ unordered_set::unordered_set(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
template
unordered_set::unordered_set(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
@@ -1042,6 +1114,31 @@ namespace unordered
table_.insert_range(f, l);
}
+ template
+ template
+ unordered_set::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
+ template
+ unordered_set::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
unordered_set::~unordered_set() BOOST_NOEXCEPT {}
@@ -1052,17 +1149,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template
unordered_set::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
@@ -1077,6 +1170,30 @@ namespace unordered
table_.insert_range(list.begin(), list.end());
}
+ template
+ unordered_set::unordered_set(
+ std::initializer_list 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
+ unordered_set::unordered_set(
+ std::initializer_list 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
unordered_set& unordered_set::operator=(
std::initializer_list list)
@@ -1284,6 +1401,20 @@ namespace unordered
{
}
+ template
+ unordered_multiset::unordered_multiset(
+ size_type n, const allocator_type &a)
+ : table_(n, hasher(), key_equal(), a)
+ {
+ }
+
+ template
+ unordered_multiset::unordered_multiset(
+ size_type n, const hasher &hf, const allocator_type &a)
+ : table_(n, hf, key_equal(), a)
+ {
+ }
+
template
unordered_multiset::unordered_multiset(allocator_type const& a)
: table_(boost::unordered::detail::default_bucket_count,
@@ -1333,6 +1464,31 @@ namespace unordered
table_.insert_range(f, l);
}
+ template
+ template
+ unordered_multiset::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
+ template
+ unordered_multiset::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
unordered_multiset::~unordered_multiset() BOOST_NOEXCEPT {}
@@ -1343,17 +1499,13 @@ namespace unordered
{
}
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-
template
unordered_multiset::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
@@ -1368,6 +1520,30 @@ namespace unordered
table_.insert_range(list.begin(), list.end());
}
+ template
+ unordered_multiset::unordered_multiset(
+ std::initializer_list 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
+ unordered_multiset::unordered_multiset(
+ std::initializer_list 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
unordered_multiset& unordered_multiset::operator=(
std::initializer_list list)
diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp
index 62a4c3fc..4663c8e5 100644
--- a/test/unordered/compile_tests.hpp
+++ b/test/unordered/compile_tests.hpp
@@ -123,6 +123,8 @@ void container_test(X& r, T const&)
sink(X(a));
X u2(a);
X u3 = a;
+ X u4(rvalue(a_const));
+ X u5 = rvalue(a_const);
a.swap(b);
boost::swap(a, b);
@@ -132,12 +134,25 @@ void container_test(X& r, T const&)
typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
test::check_return_type::equals(a_const.get_allocator());
+
+ allocator_type m = a.get_allocator();
+ sink(X(m));
+ X c(m);
+ sink(X(a_const, m));
+ X c2(a_const, m);
+ sink(X(rvalue(a_const), m));
+ X c3(rvalue(a_const), m);
// Avoid unused variable warnings:
sink(u);
sink(u2);
sink(u3);
+ sink(u4);
+ sink(u5);
+ sink(c);
+ sink(c2);
+ sink(c3);
}
template
@@ -369,6 +384,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_reference::type
const_local_iterator_reference;
+ typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
BOOST_STATIC_ASSERT((boost::is_same::value));
//boost::function_requires >();
@@ -401,8 +417,13 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
BOOST_STATIC_ASSERT((boost::is_same::value));
+ X a;
+ allocator_type m = a.get_allocator();
+
+ // Constructors
+
X(10, hf, eq);
- X a(10, hf, eq);
+ X a1(10, hf, eq);
X(10, hf);
X a2(10, hf);
X(10);
@@ -410,6 +431,15 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
X();
X a4;
+ X(10, hf, eq, m);
+ X a1a(10, hf, eq, m);
+ X(10, hf, m);
+ X a2a(10, hf, m);
+ X(10, m);
+ X a3a(10, m);
+ sink(X(m));
+ X a4a(m);
+
test::check_return_type::equals(a.erase(k));
const_iterator q1 = a.cbegin(), q2 = a.cend();
@@ -452,9 +482,14 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
// Avoid unused variable warnings:
sink(a);
+ sink(a1);
sink(a2);
sink(a3);
sink(a4);
+ sink(a1a);
+ sink(a2a);
+ sink(a3a);
+ sink(a4a);
}
template
@@ -464,14 +499,17 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
+ typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
X a;
+ allocator_type m = a.get_allocator();
BOOST_DEDUCED_TYPENAME X::value_type* i = 0;
BOOST_DEDUCED_TYPENAME X::value_type* j = 0;
- X(i, j, 10, hf, eq);
+ // Constructors
+ X(i, j, 10, hf, eq);
X a5(i, j, 10, hf, eq);
X(i, j, 10, hf);
X a6(i, j, 10, hf);
@@ -480,11 +518,38 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
X(i, j);
X a8(i, j);
+ X(i, j, 10, hf, eq, m);
+ X a5a(i, j, 10, hf, eq, m);
+ X(i, j, 10, hf, m);
+ X a6a(i, j, 10, hf, m);
+ X(i, j, 10, m);
+ X a7a(i, j, 10, m);
+
+ // Not specified for some reason (maybe ambiguity with another constructor?)
+ //X(i, j, m);
+ //X a8a(i, j, m);
+ //sink(a8a);
+
+#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
+ std::size_t min_buckets = 10;
+ X({t});
+ X({t}, min_buckets);
+ X({t}, min_buckets, hf);
+ X({t}, min_buckets, hf, eq);
+ //X({t}, m);
+ X({t}, min_buckets, m);
+ X({t}, min_buckets, hf, m);
+ X({t}, min_buckets, hf, eq, m);
+#endif
+
X const b;
sink(X(b));
X a9(b);
a = b;
+ sink(X(b, m));
+ X a9a(b, m);
+
const_iterator q = a.cbegin();
test::check_return_type::equals(a.insert(q, t));
@@ -516,6 +581,10 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
sink(a7);
sink(a8);
sink(a9);
+ sink(a5a);
+ sink(a6a);
+ sink(a7a);
+ sink(a9a);
}
template
@@ -525,6 +594,7 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
+ typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
X x1(rvalue_default());
@@ -533,9 +603,14 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
x2 = boost::move(x1);
#endif
+ X a;
+ allocator_type m = a.get_allocator();
+
test::minimal::constructor_param* i = 0;
test::minimal::constructor_param* j = 0;
+ // Constructors
+
X(i, j, 10, hf, eq);
X a5(i, j, 10, hf, eq);
X(i, j, 10, hf);
@@ -545,7 +620,17 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
X(i, j);
X a8(i, j);
- X a;
+ X(i, j, 10, hf, eq, m);
+ X a5a(i, j, 10, hf, eq, m);
+ X(i, j, 10, hf, m);
+ X a6a(i, j, 10, hf, m);
+ X(i, j, 10, m);
+ X a7a(i, j, 10, m);
+
+ // Not specified for some reason (maybe ambiguity with another constructor?)
+ //X(i, j, m);
+ //X a8a(i, j, m);
+ //sink(a8a);
const_iterator q = a.cbegin();
@@ -579,6 +664,9 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
sink(a6);
sink(a7);
sink(a8);
+ sink(a5a);
+ sink(a6a);
+ sink(a7a);
sink(a10);
}