From f64b5ba3f862d071c0eb9c77cd04f31e8aff8a49 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 29 Aug 2011 15:19:40 +0000 Subject: [PATCH] Unordered: Account for cost of creating tuple. [SVN r74133] --- test/unordered/unnecessary_copy_tests.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index a7742386..ee5a1eaa 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -408,14 +408,20 @@ namespace unnecessary_copy_tests 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 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 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