From b00bc15c3e6954ac010ff3f6823fc3bb80743208 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 2 Oct 2016 17:56:01 +0100 Subject: [PATCH] Allocator aware constructors. --- doc/changes.qbk | 1 + doc/ref.php | 169 +++++- doc/ref.xml | 676 +++++++++++++++++++++- include/boost/unordered/unordered_map.hpp | 154 ++++- include/boost/unordered/unordered_set.hpp | 142 +++++ test/unordered/compile_tests.hpp | 32 +- 6 files changed, 1164 insertions(+), 10 deletions(-) diff --git a/doc/changes.qbk b/doc/changes.qbk index 03fe1987..45267739 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -281,6 +281,7 @@ C++11 support has resulted in some breaking changes: [h2 Boost 1.63.0] +* Implement missing allocator aware constructors. * Check hint iterator in `insert`/`emplace_hint`. * Fix some warnings, mostly in the tests. * Manually write out `emplace_args` for small numbers of arguments - diff --git a/doc/ref.php b/doc/ref.php index d2fb2b42..8ca01919 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -246,7 +246,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 @@ -310,6 +315,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 d03e8dd3..cb77d263 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -187,7 +187,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 @@ -251,6 +256,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 @@ -1261,7 +1428,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 @@ -1325,6 +1497,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 @@ -2344,7 +2678,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 @@ -2408,6 +2747,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_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 + 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 @@ -3465,7 +3966,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 @@ -3529,6 +4035,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 fc6fbe0e..75b39d0f 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -108,6 +108,19 @@ 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&); @@ -139,6 +152,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 @@ -570,6 +592,13 @@ namespace unordered 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&); @@ -591,11 +620,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) @@ -611,10 +654,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, @@ -622,6 +661,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 @@ -1059,6 +1107,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 {} @@ -1094,6 +1167,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) @@ -1392,6 +1489,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 {} @@ -1427,6 +1549,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 aa9911bc..044cf1ac 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -105,6 +105,19 @@ 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&); @@ -136,6 +149,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 @@ -574,6 +596,19 @@ 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&); @@ -605,6 +640,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 @@ -1033,6 +1077,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 {} @@ -1068,6 +1137,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) @@ -1317,6 +1410,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 {} @@ -1352,6 +1470,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 12c72c9e..fb9a864d 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -111,6 +111,7 @@ void container_test(X& r, T const&) sink(X(a)); X u2(a); X u3 = a; + X u4(rvalue(a_const)); a.swap(b); boost::swap(a, b); @@ -120,12 +121,24 @@ 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(c); + sink(c2); + sink(c3); } template @@ -449,14 +462,15 @@ 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); - X a5(i, j, 10, hf, eq); X(i, j, 10, hf); X a6(i, j, 10, hf); @@ -465,6 +479,22 @@ 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, m); + X(i, j, 10, m); + //X(i, j, m); + +#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);