Unordered: Fix some portability issues in tests.

- Simplify mechanism for detecting traits of test allocators. There were
  some portability issues, but rather than fix them I've just gone for a
  simpler mechanism. Does mean that the relevant tests can't be run for
  other allocators.
- Fix a couple of unnecessary_copy_tests, whose results were the wrong
  way round.
- It appears that Visual C++ only implements RVO for implicitly defined
  copy constructors in debug mode, so adjust a move_test to account for
  the extra copies now that the copy constructors are explicitly
  defined.

[SVN r73798]
This commit is contained in:
Daniel James
2011-08-15 20:23:29 +00:00
parent f64cf03e1d
commit bbad921022
8 changed files with 112 additions and 70 deletions

View File

@@ -201,9 +201,9 @@ namespace unnecessary_copy_tests
COPY_COUNT(1); MOVE_COUNT(0);
x.emplace(boost::move(a));
#if defined(BOOST_NO_RVALUE_REFERENCES)
COPY_COUNT(1); MOVE_COUNT(1);
#else
COPY_COUNT(2); MOVE_COUNT(0);
#else
COPY_COUNT(1); MOVE_COUNT(1);
#endif
}
@@ -227,11 +227,11 @@ namespace unnecessary_copy_tests
reset();
x.emplace();
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
COPY_COUNT(1); MOVE_COUNT(0);
#else
// TODO: I think that in this case the move could be delayed until
// after checking for a collision, giving MOVE_COUNT(0).
COPY_COUNT(1); MOVE_COUNT(1);
#else
COPY_COUNT(1); MOVE_COUNT(0);
#endif
//