Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73971 - trunk/libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-08-20 19:34:14


Author: danieljames
Date: 2011-08-20 19:34:14 EDT (Sat, 20 Aug 2011)
New Revision: 73971
URL: http://svn.boost.org/trac/boost/changeset/73971

Log:
Unordered: More unnecessary_copy_tests tweaks.
Text files modified:
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 25 ++++++++++++++-----------
   1 files changed, 14 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 2011-08-20 19:34:14 EDT (Sat, 20 Aug 2011)
@@ -305,6 +305,10 @@
         source<count_copies>();
         int source_cost = ::unnecessary_copy_tests::count_copies::moves;
 
+ reset();
+ source<std::pair<count_copies, count_copies> >();
+ int source_pair_cost = ::unnecessary_copy_tests::count_copies::moves;
+
         //
 
         reset();
@@ -333,20 +337,17 @@
 
         // A new object is created by source, but it shouldn't be moved or
         // copied.
- //
- // (Note: source_cost is not needed here, because std::pair is not
- // move enabled).
         reset();
         x.emplace(source<std::pair<count_copies, count_copies> >());
- COPY_COUNT(2); MOVE_COUNT(0);
+ COPY_COUNT(2); MOVE_COUNT(source_pair_cost);
 
- // TODO: This doesn't work on older versions of gcc.
- //count_copies part;
- std::pair<count_copies const, count_copies> b;
- //reset();
- //std::pair<count_copies const&, count_copies const&> a_ref(part, part);
- //x.emplace(a_ref);
- //COPY_COUNT(0); MOVE_COUNT(0);
+#if !defined(__GNUC__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
+ count_copies part;
+ reset();
+ std::pair<count_copies const&, count_copies const&> a_ref(part, part);
+ x.emplace(a_ref);
+ COPY_COUNT(2); MOVE_COUNT(0);
+#endif
 
 #if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         // No move should take place.
@@ -360,6 +361,8 @@
         // 2 arguments
         //
 
+ std::pair<count_copies const, count_copies> b;
+
         reset();
         x.emplace(b.first, b.second);
         COPY_COUNT(0); MOVE_COUNT(0);


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