Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80200 - trunk/libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2012-08-25 08:52:32


Author: danieljames
Date: 2012-08-25 08:52:31 EDT (Sat, 25 Aug 2012)
New Revision: 80200
URL: http://svn.boost.org/trac/boost/changeset/80200

Log:
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.
Text files modified:
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 23 ++++++++++++-----------
   1 files changed, 12 insertions(+), 11 deletions(-)

Modified: trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp 2012-08-25 08:52:31 EDT (Sat, 25 Aug 2012)
@@ -170,7 +170,6 @@
     UNORDERED_TEST(unnecessary_copy_emplace_rvalue_test,
             ((set)(multiset)(map)(multimap)))
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
     template <class T>
     void unnecessary_copy_emplace_move_test(T*)
     {
@@ -178,13 +177,17 @@
         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 <class T>
     void unnecessary_copy_emplace_boost_move_set_test(T*)
@@ -270,14 +273,16 @@
         x.emplace(source<count_copies>());
         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 @@
 
 #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
         //


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk