Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.

[SVN r56461]
This commit is contained in:
Daniel James
2009-09-28 23:06:03 +00:00
parent 31cd8f4e16
commit 2b8680d2c4
2 changed files with 3 additions and 16 deletions

View File

@ -107,20 +107,6 @@ namespace unordered_detail {
return v.first;
}
template <class Second>
static key_type const& extract(
std::pair<key_type&, Second> const& v)
{
return v.first;
}
template <class Second>
static key_type const& extract(
std::pair<key_type const&, Second> const& v)
{
return v.first;
}
#if defined(BOOST_UNORDERED_STD_FORWARD)
template <class Arg1, class... Args>
static key_type const& extract(key_type const& k,

View File

@ -29,12 +29,13 @@ UNORDERED_AUTO_TEST(needless_copies_2) {
test::object_count count = test::global_object_count;
dst.emplace(src);
BOOST_TEST(test::global_object_count.instances == count.instances + 1);
BOOST_TEST_EQ(test::global_object_count.instances, count.instances + 1);
BOOST_TEST_EQ(test::global_object_count.constructions, count.constructions + 1);
count = test::global_object_count;
dst.emplace(src);
BOOST_TEST_EQ(test::global_object_count, count);
BOOST_TEST_EQ(test::global_object_count.instances, count.instances);
BOOST_TEST(test::global_object_count.constructions <= count.constructions + 1);
}
RUN_TESTS()