mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 11:27:15 +02:00
Unordered: More unnecessary_copy_tests tweaks.
[SVN r73971]
This commit is contained in:
@ -305,6 +305,10 @@ namespace unnecessary_copy_tests
|
|||||||
source<count_copies>();
|
source<count_copies>();
|
||||||
int source_cost = ::unnecessary_copy_tests::count_copies::moves;
|
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();
|
reset();
|
||||||
@ -333,20 +337,17 @@ namespace unnecessary_copy_tests
|
|||||||
|
|
||||||
// A new object is created by source, but it shouldn't be moved or
|
// A new object is created by source, but it shouldn't be moved or
|
||||||
// copied.
|
// copied.
|
||||||
//
|
|
||||||
// (Note: source_cost is not needed here, because std::pair is not
|
|
||||||
// move enabled).
|
|
||||||
reset();
|
reset();
|
||||||
x.emplace(source<std::pair<count_copies, count_copies> >());
|
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.
|
#if !defined(__GNUC__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
|
||||||
//count_copies part;
|
count_copies part;
|
||||||
std::pair<count_copies const, count_copies> b;
|
reset();
|
||||||
//reset();
|
std::pair<count_copies const&, count_copies const&> a_ref(part, part);
|
||||||
//std::pair<count_copies const&, count_copies const&> a_ref(part, part);
|
x.emplace(a_ref);
|
||||||
//x.emplace(a_ref);
|
COPY_COUNT(2); MOVE_COUNT(0);
|
||||||
//COPY_COUNT(0); MOVE_COUNT(0);
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||||
// No move should take place.
|
// No move should take place.
|
||||||
@ -360,6 +361,8 @@ namespace unnecessary_copy_tests
|
|||||||
// 2 arguments
|
// 2 arguments
|
||||||
//
|
//
|
||||||
|
|
||||||
|
std::pair<count_copies const, count_copies> b;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
x.emplace(b.first, b.second);
|
x.emplace(b.first, b.second);
|
||||||
COPY_COUNT(0); MOVE_COUNT(0);
|
COPY_COUNT(0); MOVE_COUNT(0);
|
||||||
|
Reference in New Issue
Block a user