Remove BOOST_NO_CXX11_HDR_INITIALIZER_LIST checks

This commit is contained in:
Christian Mazakas 2023-08-28 15:21:43 -07:00
parent b0ee2b5116
commit 8cbd9ad80a
6 changed files with 6 additions and 136 deletions

View File

@ -24,9 +24,7 @@
#include <boost/move/move.hpp>
#include <boost/type_traits/is_constructible.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
@ -115,12 +113,10 @@ namespace boost {
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());
#endif
explicit unordered_map(size_type, const allocator_type&);
@ -136,7 +132,6 @@ namespace boost {
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>, const allocator_type&);
unordered_map(
@ -144,7 +139,6 @@ namespace boost {
unordered_map(std::initializer_list<value_type>, size_type, const hasher&,
const allocator_type&);
#endif
// Destructor
@ -186,9 +180,7 @@ namespace boost {
#endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_map& operator=(std::initializer_list<value_type>);
#endif
allocator_type get_allocator() const noexcept
{
@ -423,9 +415,7 @@ namespace boost {
template <class InputIt> void insert(InputIt, InputIt);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#endif
// extract
@ -584,7 +574,7 @@ namespace boost {
{
return table_.try_emplace_unique(
std::move(k), boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
boost::forward<A0>(a0)));
}
template <typename A0, typename A1>
@ -593,7 +583,7 @@ namespace boost {
{
return table_.try_emplace_unique(
std::move(k), boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1)));
boost::forward<A0>(a0), boost::forward<A1>(a1)));
}
template <typename A0, typename A1, typename A2>
@ -753,9 +743,9 @@ namespace boost {
std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.try_emplace_unique(std::move(k), \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
return table_.try_emplace_unique( \
std::move(k), boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
} \
\
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
@ -771,7 +761,7 @@ namespace boost {
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.try_emplace_hint_unique(hint, std::move(k), \
return table_.try_emplace_hint_unique(hint, std::move(k), \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
}
@ -1222,12 +1212,10 @@ namespace boost {
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());
#endif
explicit unordered_multimap(size_type, const allocator_type&);
@ -1244,7 +1232,6 @@ namespace boost {
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>, const allocator_type&);
@ -1253,7 +1240,6 @@ namespace boost {
unordered_multimap(std::initializer_list<value_type>, size_type,
const hasher&, const allocator_type&);
#endif
// Destructor
@ -1295,9 +1281,7 @@ namespace boost {
#endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multimap& operator=(std::initializer_list<value_type>);
#endif
allocator_type get_allocator() const noexcept
{
@ -1525,9 +1509,7 @@ namespace boost {
template <class InputIt> void insert(InputIt, InputIt);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#endif
// extract
@ -1917,8 +1899,6 @@ namespace boost {
table_.move_construct_buckets(other.table_);
}
#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, const hasher& hf,
@ -1930,8 +1910,6 @@ namespace boost {
this->insert(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(
size_type n, const allocator_type& a)
@ -1977,8 +1955,6 @@ namespace boost {
this->insert(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, const allocator_type& a)
@ -2011,15 +1987,11 @@ namespace boost {
this->insert(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() 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)
@ -2029,8 +2001,6 @@ namespace boost {
return *this;
}
#endif
// size and capacity
template <class K, class T, class H, class P, class A>
@ -2057,14 +2027,12 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
void unordered_map<K, T, H, P, A>::insert(
std::initializer_list<value_type> list)
{
this->insert(list.begin(), list.end());
}
#endif
template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::iterator
@ -2465,8 +2433,6 @@ namespace boost {
table_.move_construct_buckets(other.table_);
}
#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, const hasher& hf,
@ -2478,8 +2444,6 @@ namespace boost {
this->insert(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(
size_type n, const allocator_type& a)
@ -2525,8 +2489,6 @@ namespace boost {
this->insert(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, const allocator_type& a)
@ -2559,15 +2521,11 @@ namespace boost {
this->insert(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() 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=(
@ -2578,8 +2536,6 @@ namespace boost {
return *this;
}
#endif
// size and capacity
template <class K, class T, class H, class P, class A>
@ -2603,14 +2559,12 @@ namespace boost {
table_.insert_range_equiv(first, last);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class K, class T, class H, class P, class A>
void unordered_multimap<K, T, H, P, A>::insert(
std::initializer_list<value_type> list)
{
this->insert(list.begin(), list.end());
}
#endif
template <class K, class T, class H, class P, class A>
typename unordered_multimap<K, T, H, P, A>::iterator

View File

@ -23,9 +23,7 @@
#include <boost/functional/hash.hpp>
#include <boost/move/move.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
@ -113,12 +111,10 @@ namespace boost {
unordered_set(BOOST_RV_REF(unordered_set), allocator_type const&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_set(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());
#endif
explicit unordered_set(size_type, const allocator_type&);
@ -134,7 +130,6 @@ namespace boost {
unordered_set(
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(
@ -142,7 +137,6 @@ namespace boost {
unordered_set(std::initializer_list<value_type>, size_type, const hasher&,
const allocator_type&);
#endif
// Destructor
@ -184,9 +178,7 @@ namespace boost {
#endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_set& operator=(std::initializer_list<value_type>);
#endif
allocator_type get_allocator() const noexcept
{
@ -422,9 +414,7 @@ namespace boost {
template <class InputIt> void insert(InputIt, InputIt);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#endif
// extract
@ -794,12 +784,10 @@ namespace boost {
unordered_multiset(
BOOST_RV_REF(unordered_multiset), allocator_type const&);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multiset(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());
#endif
explicit unordered_multiset(size_type, const allocator_type&);
@ -816,7 +804,6 @@ namespace boost {
unordered_multiset(
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&);
@ -825,7 +812,6 @@ namespace boost {
unordered_multiset(std::initializer_list<value_type>, size_type,
const hasher&, const allocator_type&);
#endif
// Destructor
@ -867,9 +853,7 @@ namespace boost {
#endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
unordered_multiset& operator=(std::initializer_list<value_type>);
#endif
allocator_type get_allocator() const noexcept
{
@ -1081,9 +1065,7 @@ namespace boost {
template <class InputIt> void insert(InputIt, InputIt);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
void insert(std::initializer_list<value_type>);
#endif
// extract
@ -1438,8 +1420,6 @@ namespace boost {
table_.move_construct_buckets(other.table_);
}
#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, size_type n, const hasher& hf,
@ -1451,8 +1431,6 @@ namespace boost {
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::unordered_set(
size_type n, const allocator_type& a)
@ -1498,8 +1476,6 @@ namespace boost {
this->insert(f, l);
}
#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)
@ -1532,15 +1508,11 @@ namespace boost {
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::~unordered_set() noexcept
{
}
#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<T, H, P, A>::operator=(
std::initializer_list<value_type> list)
@ -1550,8 +1522,6 @@ namespace boost {
return *this;
}
#endif
// size and capacity
template <class T, class H, class P, class A>
@ -1578,14 +1548,12 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
void unordered_set<T, H, P, A>::insert(
std::initializer_list<value_type> list)
{
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
typename unordered_set<T, H, P, A>::iterator
@ -1856,8 +1824,6 @@ namespace boost {
table_.move_construct_buckets(other.table_);
}
#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, size_type n, const hasher& hf,
@ -1869,8 +1835,6 @@ namespace boost {
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::unordered_multiset(
size_type n, const allocator_type& a)
@ -1916,8 +1880,6 @@ namespace boost {
this->insert(f, l);
}
#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)
@ -1950,15 +1912,11 @@ namespace boost {
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::~unordered_multiset() noexcept
{
}
#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<T, H, P, A>::operator=(
std::initializer_list<value_type> list)
@ -1968,8 +1926,6 @@ namespace boost {
return *this;
}
#endif
// size and capacity
template <class T, class H, class P, class A>
@ -1993,14 +1949,12 @@ namespace boost {
table_.insert_range_equiv(first, last);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T, class H, class P, class A>
void unordered_multiset<T, H, P, A>::insert(
std::initializer_list<value_type> list)
{
this->insert(list.begin(), list.end());
}
#endif
template <class T, class H, class P, class A>
typename unordered_multiset<T, H, P, A>::iterator

View File

@ -436,8 +436,6 @@ namespace assign_tests {
(default_generator)(generate_collisions)(limited_range)))
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST (assign_default_initializer_list) {
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
std::initializer_list<std::pair<int const, int> > init;
@ -459,9 +457,6 @@ namespace assign_tests {
BOOST_TEST(x1.empty());
}
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST (assign_initializer_list) {
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
@ -482,8 +477,6 @@ namespace assign_tests {
BOOST_TEST(x.find(10) == x.end());
BOOST_TEST(x.find(-10) != x.end());
}
#endif
}
RUN_TESTS()

View File

@ -34,16 +34,7 @@ template <class T> void sink(T const&) {}
template <class T> T rvalue(T const& v) { return v; }
template <class T> T rvalue_default() { return T(); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template <class T> T implicit_construct() { return {}; }
#else
template <class T> int implicit_construct()
{
T x;
sink(x);
return 0;
}
#endif
#if !defined(BOOST_NO_CXX11_NOEXCEPT)
#define TEST_NOEXCEPT_EXPR(x) BOOST_STATIC_ASSERT((noexcept(x)));
@ -143,13 +134,11 @@ template <class X, class T> void container_test(X& r, T const&)
// I don't test the runtime post-conditions here.
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
// It isn't specified in the container requirements that the no argument
// constructor is implicit, but it is defined that way in the concrete
// container specification.
X u_implicit = {};
sink(u_implicit);
#endif
X u;
BOOST_TEST(u.size() == 0);
@ -793,7 +782,6 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
// 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);
@ -803,7 +791,6 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
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));
@ -826,7 +813,6 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
test::check_return_type<iterator>::equals(a.emplace_hint(q, t));
a.insert(i, j);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
std::initializer_list<T> list = {t};
a.insert(list);
a.insert({t, t, t});
@ -837,7 +823,6 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq)
a.insert({});
a.insert({t});
a.insert({t, t});
#endif
#endif
X a10;

View File

@ -324,7 +324,6 @@ namespace constructor_tests {
test::check_equivalent_keys(x);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
typedef typename T::value_type value_type;
std::initializer_list<value_type> list;
@ -525,7 +524,6 @@ namespace constructor_tests {
test::check_container(x, expected);
}
}
#endif
}
template <class T>
@ -608,7 +606,6 @@ namespace constructor_tests {
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_SUB_TEST("Initializer list 1")
{
std::initializer_list<typename T::value_type> list;
@ -633,7 +630,6 @@ namespace constructor_tests {
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
}
}
#endif
}
template <class T>
@ -721,8 +717,6 @@ namespace constructor_tests {
(default_generator)(generate_collisions)(limited_range)))
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST (test_default_initializer_list) {
std::initializer_list<int> init;
#ifdef BOOST_UNORDERED_FOA_TESTS
@ -735,10 +729,6 @@ namespace constructor_tests {
BOOST_TEST(x1.empty());
}
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
UNORDERED_AUTO_TEST (test_initializer_list) {
#ifdef BOOST_UNORDERED_FOA_TESTS
boost::unordered_flat_set<int> x1 = {2, 10, 45, -5};
@ -752,8 +742,6 @@ namespace constructor_tests {
BOOST_TEST(x1.find(10) != x1.end());
BOOST_TEST(x1.find(46) == x1.end());
}
#endif
} // namespace constructor_tests
RUN_TESTS_QUIET()

View File

@ -1079,8 +1079,6 @@ namespace insert_tests {
UNORDERED_TEST(set_tests2, ((test_pc_set)))
#endif
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
struct initialize_from_two_ints
{
int a, b;
@ -1201,8 +1199,6 @@ namespace insert_tests {
BOOST_TEST_EQ(multimap.size(), 3u);
BOOST_TEST_EQ(multimap.count("a"), 2u);
}
#endif
#endif
struct overloaded_constructor