Implement missing constructors outlined by LWG issue 2713 (#160)

* Harden initializer_list constructor tests

* Add tests for constructors as specified in LWG issue 2713

* Add missing constructors to unordered_flat_map

* Add missing constructors to unordered_flat_set

* Add missing constructors to unordered_[multi]map

* Add missing constructors to unordered_[multi]set
This commit is contained in:
Christian Mazakas
2022-11-05 05:08:29 -07:00
committed by GitHub
parent d3985f87b3
commit 4310809025
5 changed files with 317 additions and 33 deletions

View File

@@ -106,6 +106,13 @@ namespace boost {
{
}
template <class InputIterator>
unordered_flat_map(
InputIterator f, InputIterator l, allocator_type const& a)
: unordered_flat_map(f, l, size_type(0), hasher(), key_equal(), a)
{
}
explicit unordered_flat_map(allocator_type const& a)
: unordered_flat_map(0, a)
{
@@ -165,6 +172,12 @@ namespace boost {
{
}
unordered_flat_map(
std::initializer_list<value_type> il, allocator_type const& a)
: unordered_flat_map(il, size_type(0), hasher(), key_equal(), a)
{
}
unordered_flat_map(std::initializer_list<value_type> init, size_type n,
allocator_type const& a)
: unordered_flat_map(init, n, hasher(), key_equal(), a)

View File

@@ -88,6 +88,13 @@ namespace boost {
{
}
template <class InputIterator>
unordered_flat_set(
InputIterator f, InputIterator l, allocator_type const& a)
: unordered_flat_set(f, l, size_type(0), hasher(), key_equal(), a)
{
}
explicit unordered_flat_set(allocator_type const& a)
: unordered_flat_set(0, a)
{
@@ -147,6 +154,12 @@ namespace boost {
{
}
unordered_flat_set(
std::initializer_list<value_type> il, allocator_type const& a)
: unordered_flat_set(il, size_type(0), hasher(), key_equal(), a)
{
}
unordered_flat_set(std::initializer_list<value_type> init, size_type n,
allocator_type const& a)
: unordered_flat_set(init, n, hasher(), key_equal(), a)

View File

@@ -123,6 +123,9 @@ namespace boost {
explicit unordered_map(size_type, const hasher&, const allocator_type&);
template <class InputIterator>
unordered_map(InputIterator, InputIterator, const allocator_type&);
template <class InputIt>
unordered_map(InputIt, InputIt, size_type, const allocator_type&);
@@ -131,6 +134,8 @@ namespace boost {
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_map(std::initializer_list<value_type>, const allocator_type&);
unordered_map(
std::initializer_list<value_type>, size_type, const allocator_type&);
@@ -1076,6 +1081,9 @@ namespace boost {
explicit unordered_multimap(
size_type, const hasher&, const allocator_type&);
template <class InputIterator>
unordered_multimap(InputIterator, InputIterator, const allocator_type&);
template <class InputIt>
unordered_multimap(InputIt, InputIt, size_type, const allocator_type&);
@@ -1084,6 +1092,9 @@ namespace boost {
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multimap(
std::initializer_list<value_type>, const allocator_type&);
unordered_multimap(
std::initializer_list<value_type>, size_type, const allocator_type&);
@@ -1751,6 +1762,17 @@ namespace boost {
{
}
template <class K, class T, class H, class P, class A>
template <class InputIterator>
unordered_map<K, T, H, P, A>::unordered_map(
InputIterator f, InputIterator l, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
f, l, detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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(
@@ -1773,6 +1795,16 @@ namespace boost {
#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, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
list.begin(), list.end(), detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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,
@@ -2234,6 +2266,17 @@ namespace boost {
{
}
template <class K, class T, class H, class P, class A>
template <class InputIterator>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
InputIterator f, InputIterator l, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
f, l, detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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(
@@ -2256,6 +2299,16 @@ namespace boost {
#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, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
list.begin(), list.end(), detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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,

View File

@@ -121,6 +121,9 @@ namespace boost {
explicit unordered_set(size_type, const hasher&, const allocator_type&);
template <class InputIterator>
unordered_set(InputIterator, InputIterator, const allocator_type&);
template <class InputIt>
unordered_set(InputIt, InputIt, size_type, const allocator_type&);
@@ -129,6 +132,8 @@ namespace boost {
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_set(std::initializer_list<value_type>, const allocator_type&);
unordered_set(
std::initializer_list<value_type>, size_type, const allocator_type&);
@@ -739,6 +744,9 @@ namespace boost {
explicit unordered_multiset(
size_type, const hasher&, const allocator_type&);
template <class InputIterator>
unordered_multiset(InputIterator, InputIterator, const allocator_type&);
template <class InputIt>
unordered_multiset(InputIt, InputIt, size_type, const allocator_type&);
@@ -747,6 +755,9 @@ namespace boost {
InputIt, InputIt, size_type, const hasher&, const allocator_type&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multiset(
std::initializer_list<value_type>, const allocator_type&);
unordered_multiset(
std::initializer_list<value_type>, size_type, const allocator_type&);
@@ -1352,6 +1363,17 @@ namespace boost {
{
}
template <class T, class H, class P, class A>
template <class InputIterator>
unordered_set<T, H, P, A>::unordered_set(
InputIterator f, InputIterator l, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
f, l, detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(f, l);
}
template <class T, class H, class P, class A>
template <class InputIt>
unordered_set<T, H, P, A>::unordered_set(
@@ -1374,6 +1396,16 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::unordered_set(
std::initializer_list<value_type> list, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
list.begin(), list.end(), detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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,
@@ -1750,6 +1782,17 @@ namespace boost {
{
}
template <class T, class H, class P, class A>
template <class InputIterator>
unordered_multiset<T, H, P, A>::unordered_multiset(
InputIterator f, InputIterator l, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
f, l, detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(f, l);
}
template <class T, class H, class P, class A>
template <class InputIt>
unordered_multiset<T, H, P, A>::unordered_multiset(
@@ -1772,6 +1815,16 @@ namespace boost {
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::unordered_multiset(
std::initializer_list<value_type> list, const allocator_type& a)
: table_(boost::unordered::detail::initial_size(
list.begin(), list.end(), detail::default_bucket_count),
hasher(), key_equal(), a)
{
this->insert(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,