Remove BOOST_NO_CXX11_RVALUE_REFERENCES

This commit is contained in:
Christian Mazakas 2023-08-31 13:11:31 -07:00
parent 3f0f8efbba
commit 0c7b51cc16
8 changed files with 9 additions and 178 deletions

View File

@ -2987,22 +2987,6 @@ namespace boost {
return v.first;
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class Second>
static key_type const& extract(
boost::rv<std::pair<key_type, Second> > const& v)
{
return v.first;
}
template <class Second>
static key_type const& extract(
boost::rv<std::pair<key_type const, Second> > const& v)
{
return v.first;
}
#endif
template <class Arg1>
static key_type const& extract(key_type const& k, Arg1 const&)
{

View File

@ -288,16 +288,6 @@ namespace boost {
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0))
private:
// Note: Use r-value node_type to insert.
insert_return_type insert(node_type&);
iterator insert(const_iterator, node_type& np);
public:
#endif
template <class... Args>
std::pair<iterator, bool> try_emplace(key_type const& k, Args&&... args)
{
@ -420,18 +410,14 @@ namespace boost {
template <typename H2, typename P2>
void merge(boost::unordered_map<K, T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_map<K, T, H2, P2, A>&& source);
#endif
template <typename H2, typename P2>
void merge(boost::unordered_multimap<K, T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_multimap<K, T, H2, P2, A>&& source);
#endif
// observers
@ -942,16 +928,6 @@ namespace boost {
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0))
private:
// Note: Use r-value node_type to insert.
iterator insert(node_type&);
iterator insert(const_iterator, node_type& np);
public:
#endif
iterator erase(iterator);
iterator erase(const_iterator);
size_type erase(const key_type&);
@ -980,18 +956,14 @@ namespace boost {
template <typename H2, typename P2>
void merge(boost::unordered_multimap<K, T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_multimap<K, T, H2, P2, A>&& source);
#endif
template <typename H2, typename P2>
void merge(boost::unordered_map<K, T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_map<K, T, H2, P2, A>&& source);
#endif
// observers
@ -1477,7 +1449,6 @@ namespace boost {
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
@ -1485,7 +1456,6 @@ namespace boost {
{
table_.merge_unique(source.table_);
}
#endif
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
@ -1495,7 +1465,6 @@ namespace boost {
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
@ -1503,7 +1472,6 @@ namespace boost {
{
table_.merge_unique(source.table_);
}
#endif
// observers
@ -2027,7 +1995,6 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_multimap<K, T, H, P, A>::merge(
@ -2037,7 +2004,6 @@ namespace boost {
insert(source.extract(source.begin()));
}
}
#endif
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
@ -2049,7 +2015,6 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class K, class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_multimap<K, T, H, P, A>::merge(
@ -2059,7 +2024,6 @@ namespace boost {
insert(source.extract(source.begin()));
}
}
#endif
// lookup

View File

@ -287,16 +287,6 @@ namespace boost {
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0))
private:
// Note: Use r-value node_type to insert.
insert_return_type insert(node_type&);
iterator insert(const_iterator, node_type& np);
public:
#endif
iterator erase(const_iterator);
size_type erase(const key_type&);
iterator erase(const_iterator, const_iterator);
@ -324,18 +314,14 @@ namespace boost {
template <typename H2, typename P2>
void merge(boost::unordered_set<T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_set<T, H2, P2, A>&& source);
#endif
template <typename H2, typename P2>
void merge(boost::unordered_multiset<T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_multiset<T, H2, P2, A>&& source);
#endif
// observers
@ -771,16 +757,6 @@ namespace boost {
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0))
private:
// Note: Use r-value node_type to insert.
iterator insert(node_type&);
iterator insert(const_iterator, node_type& np);
public:
#endif
iterator erase(const_iterator);
size_type erase(const key_type&);
@ -808,18 +784,14 @@ namespace boost {
template <typename H2, typename P2>
void merge(boost::unordered_multiset<T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_multiset<T, H2, P2, A>&& source);
#endif
template <typename H2, typename P2>
void merge(boost::unordered_set<T, H2, P2, A>& source);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <typename H2, typename P2>
void merge(boost::unordered_set<T, H2, P2, A>&& source);
#endif
// observers
@ -1279,7 +1251,6 @@ namespace boost {
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
@ -1287,7 +1258,6 @@ namespace boost {
{
table_.merge_unique(source.table_);
}
#endif
template <class T, class H, class P, class A>
template <typename H2, typename P2>
@ -1297,7 +1267,6 @@ namespace boost {
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
@ -1305,7 +1274,6 @@ namespace boost {
{
table_.merge_unique(source.table_);
}
#endif
// lookup
@ -1682,7 +1650,6 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_multiset<T, H, P, A>::merge(
@ -1692,7 +1659,6 @@ namespace boost {
insert(source.extract(source.begin()));
}
}
#endif
template <class T, class H, class P, class A>
template <typename H2, typename P2>
@ -1704,7 +1670,6 @@ namespace boost {
}
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T, class H, class P, class A>
template <typename H2, typename P2>
void unordered_multiset<T, H, P, A>::merge(
@ -1714,7 +1679,6 @@ namespace boost {
insert(source.extract(source.begin()));
}
}
#endif
// lookup

View File

@ -177,7 +177,6 @@ namespace test {
void dummy_member() const {}
};
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
class movable2
{
public:
@ -193,9 +192,6 @@ namespace test {
movable2(movable2 const&);
movable2& operator=(movable2 const&);
};
#else
typedef movable1 movable2;
#endif
template <class T> class hash
{

View File

@ -218,13 +218,11 @@ template <class X> void unordered_destructible_test(X&)
X x1;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
X x2(rvalue_default<X>());
X x3 = rvalue_default<X>();
// This can only be done if propagate_on_container_move_assignment::value
// is true.
// x2 = rvalue_default<X>();
#endif
// This can only be done if propagate_on_container_move_assignment::value
// is true.
// x2 = rvalue_default<X>();
X* ptr = new X();
X& a1 = *ptr;
@ -727,9 +725,7 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
a.rehash(100);
a.merge(a2);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
a.merge(rvalue_default<X>());
#endif
// Avoid unused variable warnings:
@ -864,12 +860,10 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
typedef typename X::const_iterator const_iterator;
typedef typename X::allocator_type allocator_type;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
X x1(rvalue_default<X>());
X x2(std::move(x1));
x1 = rvalue_default<X>();
x2 = std::move(x1);
#endif
X a;
allocator_type m = a.get_allocator();

View File

@ -23,12 +23,7 @@
namespace move_tests {
test::seed_t initialize_seed(98624);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#define BOOST_UNORDERED_TEST_MOVING 1
#else
#define BOOST_UNORDERED_TEST_MOVING 0
#endif
template <class T> T empty(T*) { return T(); }
@ -73,8 +68,6 @@ namespace move_tests {
BOOST_TEST(y.max_load_factor() == 1.0);
#endif
test::check_equivalent_keys(y);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#ifdef BOOST_UNORDERED_FOA_TESTS
using allocator_type = typename T::allocator_type;
@ -86,7 +79,6 @@ namespace move_tests {
}
#else
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
#endif
#endif
}
@ -126,8 +118,7 @@ namespace move_tests {
T y;
y = empty(p);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#ifdef BOOST_UNORDERED_FOA_TESTS
using allocator_type = typename T::allocator_type;
using value_type =
@ -138,7 +129,6 @@ namespace move_tests {
}
#else
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
#endif
#endif
test::check_container(y, v);
test::check_equivalent_keys(y);
@ -200,23 +190,8 @@ namespace move_tests {
test::random_values<T> v(25, generator);
T y(create(v, count, hf, eq, al, 1.0), al);
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_TEST(count == test::global_object_count);
#elif defined(BOOST_HAS_NRVO)
BOOST_TEST(
static_cast<std::size_t>(
test::global_object_count.constructions - count.constructions) <=
(test::is_set<T>::value ? 1 : 2) *
(test::has_unique_keys<T>::value ? 25 : v.size()));
BOOST_TEST(count.instances == test::global_object_count.instances);
#else
BOOST_TEST(
static_cast<std::size_t>(
test::global_object_count.constructions - count.constructions) <=
(test::is_set<T>::value ? 2 : 4) *
(test::has_unique_keys<T>::value ? 25 : v.size()));
BOOST_TEST(count.instances == test::global_object_count.instances);
#endif
test::check_container(y, v);
BOOST_TEST(test::equivalent(y.hash_function(), hf));
BOOST_TEST(test::equivalent(y.key_eq(), eq));
@ -314,8 +289,7 @@ namespace move_tests {
#endif
y = std::move(x);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#ifdef BOOST_UNORDERED_FOA_TESTS
{
using value_type =
@ -327,7 +301,6 @@ namespace move_tests {
}
#else
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
#endif
#endif
test::check_container(y, v);
test::check_equivalent_keys(y);

View File

@ -21,12 +21,7 @@
namespace move_tests {
test::seed_t initialize_seed(98624);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#define BOOST_UNORDERED_TEST_MOVING 1
#else
#define BOOST_UNORDERED_TEST_MOVING 0
#endif
template <class T> T empty(T*) { return T(); }
@ -463,8 +458,6 @@ namespace move_tests {
T x(std::move(y));
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_TEST(y.empty());
BOOST_TEST(y.begin() == y.end());
@ -482,8 +475,6 @@ namespace move_tests {
#else
BOOST_TEST_EQ(y.bucket_count(), 0u);
BOOST_TEST_EQ(test::detail::tracker.count_allocations, num_allocs);
#endif
#endif
fps[i](y, v);
@ -532,8 +523,6 @@ namespace move_tests {
T x(empty(ptr));
x = std::move(y);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_TEST(y.empty());
BOOST_TEST(y.begin() == y.end());
@ -551,8 +540,6 @@ namespace move_tests {
#else
BOOST_TEST_EQ(y.bucket_count(), 0u);
BOOST_TEST_EQ(test::detail::tracker.count_allocations, num_allocs);
#endif
#endif
fps[i](y, v);
@ -582,17 +569,10 @@ namespace move_tests {
bool b = boost::allocator_propagate_on_container_move_assignment<
typename T::allocator_type>::type::value;
if (b) {
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
BOOST_TEST(y.empty());
BOOST_TEST(y.begin() == y.end());
BOOST_TEST_EQ(y.bucket_count(), 0u);
BOOST_TEST_EQ(test::detail::tracker.count_allocations, num_allocs);
#else
BOOST_TEST_NOT(y.empty());
BOOST_TEST(y.begin() != y.end());
#endif
} else {
#ifdef BOOST_UNORDERED_FOA_TESTS
BOOST_TEST(y.empty());

View File

@ -210,24 +210,16 @@ namespace unnecessary_copy_tests {
typename T::value_type a;
reset();
x.insert(std::move(a));
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1);
MOVE_COUNT(0);
#else
COPY_COUNT(0);
MOVE_COUNT(1);
#endif
typename T::value_type a2;
reset();
x.insert(std::move(a));
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT((x.size() == 2 ? 1 : 0));
MOVE_COUNT(0);
#else
COPY_COUNT(0);
MOVE_COUNT((x.size() == 2 ? 1 : 0));
#endif
}
boost::unordered_set<count_copies>* set;
@ -254,11 +246,7 @@ namespace unnecessary_copy_tests {
reset();
T x;
x.emplace(source<typename T::value_type>());
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1);
#else
COPY_COUNT(2);
#endif
}
UNORDERED_TEST(
@ -266,7 +254,6 @@ namespace unnecessary_copy_tests {
UNORDERED_TEST(
unnecessary_copy_emplace_rvalue_test, ((set)(multiset)(map)(multimap)))
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T> void unnecessary_copy_emplace_std_move_test(T*)
{
reset();
@ -281,7 +268,6 @@ namespace unnecessary_copy_tests {
UNORDERED_TEST(
unnecessary_copy_emplace_std_move_test, ((set)(multiset)(map)(multimap)))
#endif
template <class T> void unnecessary_copy_emplace_boost_move_test(T*)
{
@ -291,14 +277,8 @@ namespace unnecessary_copy_tests {
COPY_COUNT(1);
MOVE_COUNT_EXTRA(0, 1);
x.emplace(std::move(a));
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1);
MOVE_COUNT(1);
#else
// Since std::pair isn't movable, move only works for sets.
COPY_COUNT_RANGE(1, 2);
MOVE_COUNT_RANGE(0, 1);
#endif
}
UNORDERED_TEST(
@ -329,13 +309,9 @@ namespace unnecessary_copy_tests {
COPY_COUNT(1);
MOVE_COUNT_EXTRA(0, 1);
x.emplace(std::move(a));
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(2);
MOVE_COUNT_EXTRA(0, 1);
#else
COPY_COUNT(1);
MOVE_COUNT(1);
#endif
}
UNORDERED_TEST(