mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
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:
@ -107,20 +107,6 @@ namespace unordered_detail {
|
|||||||
return v.first;
|
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)
|
#if defined(BOOST_UNORDERED_STD_FORWARD)
|
||||||
template <class Arg1, class... Args>
|
template <class Arg1, class... Args>
|
||||||
static key_type const& extract(key_type const& k,
|
static key_type const& extract(key_type const& k,
|
||||||
|
@ -29,12 +29,13 @@ UNORDERED_AUTO_TEST(needless_copies_2) {
|
|||||||
|
|
||||||
test::object_count count = test::global_object_count;
|
test::object_count count = test::global_object_count;
|
||||||
dst.emplace(src);
|
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);
|
BOOST_TEST_EQ(test::global_object_count.constructions, count.constructions + 1);
|
||||||
|
|
||||||
count = test::global_object_count;
|
count = test::global_object_count;
|
||||||
dst.emplace(src);
|
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()
|
RUN_TESTS()
|
||||||
|
Reference in New Issue
Block a user