From 2b8680d2c459fc648d9c5ce5526dae9655983bc4 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 28 Sep 2009 23:06:03 +0000 Subject: [PATCH] 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] --- include/boost/unordered/detail/extract_key.hpp | 14 -------------- test/unordered/insert_range_tests.cpp | 5 +++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/include/boost/unordered/detail/extract_key.hpp b/include/boost/unordered/detail/extract_key.hpp index 59fab7c2..d415d935 100644 --- a/include/boost/unordered/detail/extract_key.hpp +++ b/include/boost/unordered/detail/extract_key.hpp @@ -107,20 +107,6 @@ namespace unordered_detail { return v.first; } - template - static key_type const& extract( - std::pair const& v) - { - return v.first; - } - - template - static key_type const& extract( - std::pair const& v) - { - return v.first; - } - #if defined(BOOST_UNORDERED_STD_FORWARD) template static key_type const& extract(key_type const& k, diff --git a/test/unordered/insert_range_tests.cpp b/test/unordered/insert_range_tests.cpp index ef55cf6b..b9234796 100644 --- a/test/unordered/insert_range_tests.cpp +++ b/test/unordered/insert_range_tests.cpp @@ -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()