mirror of
https://github.com/boostorg/unordered.git
synced 2025-10-29 14:51:46 +01:00
Remove BOOST_NO_CXX11_RVALUE_REFERENCES
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user