Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74133 - trunk/libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-08-29 11:19:41


Author: danieljames
Date: 2011-08-29 11:19:40 EDT (Mon, 29 Aug 2011)
New Revision: 74133
URL: http://svn.boost.org/trac/boost/changeset/74133

Log:
Unordered: Account for cost of creating tuple.
Text files modified:
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 12 +++++++++---
   1 files changed, 9 insertions(+), 3 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-29 11:19:40 EDT (Mon, 29 Aug 2011)
@@ -408,14 +408,20 @@
                 std::make_tuple(std::ref(b.second)));
         COPY_COUNT(0); MOVE_COUNT(0);
 
- // first is const so it is copied.
- // second is not const so it is moved.
+ std::pair<count_copies const, count_copies> move_source_trial;
+ reset();
+ std::make_tuple(std::move(move_source_trial.first));
+ std::make_tuple(std::move(move_source_trial.second));
+ int tuple_move_cost = ::unnecessary_copy_tests::count_copies::moves;
+ int tuple_copy_cost = ::unnecessary_copy_tests::count_copies::copies;
+
         std::pair<count_copies const, count_copies> move_source;
         reset();
         x.emplace(boost::unordered::piecewise_construct,
                 std::make_tuple(std::move(move_source.first)),
                 std::make_tuple(std::move(move_source.second)));
- COPY_COUNT(1); MOVE_COUNT(1);
+ COPY_COUNT(tuple_copy_cost);
+ MOVE_COUNT(tuple_move_cost);
 
 #if defined(__GNUC__) && __GNUC__ > 4 || \
     defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 6


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