From 2e11fd8a86cbd4cad174f449a9e9cb0e82c2841a Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 25 Aug 2012 12:52:31 +0000 Subject: [PATCH] Unordered: Test number of copies and moves for moves on all compilers. Mainly because I want to get more info on the odd test failure for Visual C++ 11. I expect that with move emulation these results could vary considerably, and since I've only tested with gcc and clang so far, it's quite likely that this test will now fail for other compilers. [SVN r80200] --- test/unordered/unnecessary_copy_tests.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index 29ca4282..284dd56b 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -170,7 +170,6 @@ namespace unnecessary_copy_tests UNORDERED_TEST(unnecessary_copy_emplace_rvalue_test, ((set)(multiset)(map)(multimap))) -#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE) template void unnecessary_copy_emplace_move_test(T*) { @@ -178,13 +177,17 @@ namespace unnecessary_copy_tests T x; BOOST_DEDUCED_TYPENAME T::value_type a; COPY_COUNT(1); MOVE_COUNT(0); - x.emplace(std::move(a)); + x.emplace(boost::move(a)); +#if !defined(BOOST_NO_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(unnecessary_copy_emplace_move_test, ((set)(multiset)(map)(multimap))) -#endif template void unnecessary_copy_emplace_boost_move_set_test(T*) @@ -270,14 +273,16 @@ namespace unnecessary_copy_tests x.emplace(source()); COPY_COUNT(1); MOVE_COUNT(source_cost); -#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE) // No move should take place. reset(); - x.emplace(std::move(a)); + x.emplace(boost::move(a)); +#if !defined(BOOST_NO_RVALUE_REFERENCES) COPY_COUNT(0); MOVE_COUNT(0); +#else + COPY_COUNT(0); MOVE_COUNT(1); #endif - // Just in case a did get moved... + // Use a new value for cases where a did get moved... count_copies b; // The container will have to create a copy in order to compare with @@ -367,16 +372,12 @@ namespace unnecessary_copy_tests #endif -#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE) - // No move should take place. // (since a is already in the container) reset(); - x.emplace(std::move(a)); + x.emplace(boost::move(a)); COPY_COUNT(0); MOVE_COUNT(0); -#endif - // // 2 arguments //