Reorder the constructors to match the draft standard

In order to make it easier to check against the standard.  This includes
collapsing some of the input iterator overloads into one constructor.
This commit is contained in:
Daniel James
2017-04-20 22:59:00 +01:00
parent ee73a53497
commit af94e6a40e
2 changed files with 351 additions and 400 deletions

View File

@@ -85,36 +85,14 @@ template <class K, class T, class H, class P, class A> class unordered_map
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 <class InputIt> unordered_map(InputIt, InputIt);
template <class InputIt>
unordered_map(InputIt, InputIt, size_type, const hasher& = hasher(),
const key_equal& = key_equal());
template <class InputIt>
unordered_map(InputIt, InputIt, size_type, const hasher&, const key_equal&,
const allocator_type&);
template <class InputIt>
unordered_map(
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
template <class InputIt>
unordered_map(InputIt, InputIt, size_type, const allocator_type&);
// copy/move constructors
unordered_map(InputIt, InputIt,
size_type = boost::unordered::detail::default_bucket_count,
const hasher& = hasher(), const key_equal& = key_equal(),
const allocator_type& = allocator_type());
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)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
@@ -129,15 +107,36 @@ template <class K, class T, class H, class P, class A> class unordered_map
}
#endif
explicit unordered_map(allocator_type const&);
unordered_map(unordered_map const&, allocator_type const&);
unordered_map(BOOST_RV_REF(unordered_map), allocator_type const&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_map(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
const hasher& = hasher(), const key_equal& l = key_equal(),
const allocator_type& = allocator_type());
unordered_map(std::initializer_list<value_type>, size_type, const hasher&,
const allocator_type&);
#endif
explicit unordered_map(size_type, const allocator_type&);
explicit unordered_map(size_type, const hasher&, const allocator_type&);
template <class InputIt>
unordered_map(InputIt, InputIt, size_type, const allocator_type&);
template <class InputIt>
unordered_map(
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_map(
std::initializer_list<value_type>, size_type, const allocator_type&);
unordered_map(std::initializer_list<value_type>, size_type, const hasher&,
const allocator_type&);
#endif
// Destructor
@@ -800,37 +799,14 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
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 <class InputIt> unordered_multimap(InputIt, InputIt);
template <class InputIt>
unordered_multimap(InputIt, InputIt, size_type, const hasher& = hasher(),
const key_equal& = key_equal());
template <class InputIt>
unordered_multimap(InputIt, InputIt, size_type, const hasher&,
const key_equal&, const allocator_type&);
template <class InputIt>
unordered_multimap(
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
template <class InputIt>
unordered_multimap(InputIt, InputIt, size_type, const allocator_type&);
// copy/move constructors
unordered_multimap(InputIt, InputIt,
size_type = boost::unordered::detail::default_bucket_count,
const hasher& = hasher(), const key_equal& = key_equal(),
const allocator_type& = allocator_type());
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)
BOOST_NOEXCEPT_IF(table::nothrow_move_constructible)
@@ -845,15 +821,37 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
}
#endif
explicit unordered_multimap(allocator_type const&);
unordered_multimap(unordered_multimap const&, allocator_type const&);
unordered_multimap(BOOST_RV_REF(unordered_multimap), allocator_type const&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multimap(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
const hasher& = hasher(), const key_equal& l = key_equal(),
const allocator_type& = allocator_type());
unordered_multimap(std::initializer_list<value_type>, size_type,
const hasher&, const allocator_type&);
#endif
explicit unordered_multimap(size_type, const allocator_type&);
explicit unordered_multimap(
size_type, const hasher&, const allocator_type&);
template <class InputIt>
unordered_multimap(InputIt, InputIt, size_type, const allocator_type&);
template <class InputIt>
unordered_multimap(
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multimap(
std::initializer_list<value_type>, size_type, const allocator_type&);
unordered_multimap(std::initializer_list<value_type>, size_type,
const hasher&, const allocator_type&);
#endif
// Destructor
@@ -1243,16 +1241,17 @@ unordered_map<K, T, H, P, A>::unordered_map(size_type n, const hasher& hf,
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
size_type n, const allocator_type& a)
: table_(n, hasher(), key_equal(), a)
template <class InputIt>
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
const hasher& hf, const key_equal& eql, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
size_type n, const hasher& hf, const allocator_type& a)
: table_(n, hf, key_equal(), a)
unordered_map<K, T, H, P, A>::unordered_map(unordered_map const& other)
: table_(other.table_)
{
}
@@ -1270,65 +1269,6 @@ unordered_map<K, T, H, P, A>::unordered_map(
{
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l)
: table_(boost::unordered::detail::initial_size(f, l), hasher(),
key_equal(), allocator_type())
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::unordered_map(
InputIt f, InputIt l, size_type n, const hasher& hf, const key_equal& eql)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql,
allocator_type())
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
const hasher& hf, const key_equal& eql, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::~unordered_map() BOOST_NOEXCEPT
{
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(unordered_map const& other)
: table_(other.table_)
{
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
BOOST_RV_REF(unordered_map) other, allocator_type const& a)
@@ -1349,17 +1289,44 @@ unordered_map<K, T, H, P, A>::unordered_map(
table_.insert_range(list.begin(), list.end());
}
#endif
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
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)
size_type n, const allocator_type& a)
: table_(n, hasher(), key_equal(), a)
{
table_.insert_range(list.begin(), list.end());
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
size_type n, const hasher& hf, const allocator_type& a)
: table_(n, hf, key_equal(), a)
{
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_map<K, T, H, P, A>::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);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
std::initializer_list<value_type> list, size_type n,
@@ -1371,6 +1338,26 @@ unordered_map<K, T, H, P, A>::unordered_map(
table_.insert_range(list.begin(), list.end());
}
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
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());
}
#endif
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::~unordered_map() BOOST_NOEXCEPT
{
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>& unordered_map<K, T, H, P, A>::operator=(
std::initializer_list<value_type> list)
@@ -1663,16 +1650,19 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(size_type n,
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
size_type n, const allocator_type& a)
: table_(n, hasher(), key_equal(), a)
template <class InputIt>
unordered_multimap<K, T, H, P, A>::unordered_multimap(InputIt f, InputIt l,
size_type n, const hasher& hf, const key_equal& eql,
const allocator_type& a)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
size_type n, const hasher& hf, const allocator_type& a)
: table_(n, hf, key_equal(), a)
unordered_multimap const& other)
: table_(other.table_)
{
}
@@ -1690,67 +1680,6 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
{
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::unordered_multimap(InputIt f, InputIt l)
: table_(boost::unordered::detail::initial_size(f, l), hasher(),
key_equal(), allocator_type())
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
InputIt f, InputIt l, size_type n, const hasher& hf, const key_equal& eql)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql,
allocator_type())
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::unordered_multimap(InputIt f, InputIt l,
size_type n, const hasher& hf, const key_equal& eql,
const allocator_type& a)
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
{
table_.insert_range(f, l);
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::~unordered_multimap() BOOST_NOEXCEPT
{
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
unordered_multimap const& other)
: table_(other.table_)
{
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
BOOST_RV_REF(unordered_multimap) other, allocator_type const& a)
@@ -1771,17 +1700,44 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
table_.insert_range(list.begin(), list.end());
}
#endif
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
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)
size_type n, const allocator_type& a)
: table_(n, hasher(), key_equal(), a)
{
table_.insert_range(list.begin(), list.end());
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
size_type n, const hasher& hf, const allocator_type& a)
: table_(n, hf, key_equal(), a)
{
}
template <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::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 <class K, class T, class H, class P, class A>
template <class InputIt>
unordered_multimap<K, T, H, P, A>::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);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
std::initializer_list<value_type> list, size_type n,
@@ -1793,6 +1749,26 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
table_.insert_range(list.begin(), list.end());
}
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
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());
}
#endif
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::~unordered_multimap() BOOST_NOEXCEPT
{
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>& unordered_multimap<K, T, H, P, A>::operator=(
std::initializer_list<value_type> list)