|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81393 - in trunk: boost/unordered/detail libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2012-11-17 07:03:55
Author: danieljames
Date: 2012-11-17 07:03:55 EST (Sat, 17 Nov 2012)
New Revision: 81393
URL: http://svn.boost.org/trac/boost/changeset/81393
Log:
Unordered: Fix overload edge case for piecewise construction.
Text files modified:
trunk/boost/unordered/detail/extract_key.hpp | 4 ++--
trunk/libs/unordered/test/unordered/insert_tests.cpp | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2012-11-17 07:03:55 EST (Sat, 17 Nov 2012)
@@ -138,7 +138,7 @@
#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
template <typename T2> \
static no_key extract(boost::unordered::piecewise_construct_t, \
- namespace_ tuple<> const&, BOOST_FWD_REF(T2)) \
+ namespace_ tuple<> const&, T2 const&) \
{ \
return no_key(); \
} \
@@ -146,7 +146,7 @@
template <typename T, typename T2> \
static typename is_key<key_type, T>::type \
extract(boost::unordered::piecewise_construct_t, \
- namespace_ tuple<T> const& k, BOOST_FWD_REF(T2)) \
+ namespace_ tuple<T> const& k, T2 const&) \
{ \
return typename is_key<key_type, T>::type( \
namespace_ get<0>(k)); \
Modified: trunk/libs/unordered/test/unordered/insert_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/insert_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/insert_tests.cpp 2012-11-17 07:03:55 EST (Sat, 17 Nov 2012)
@@ -698,6 +698,12 @@
return derived_from_piecewise_construct_t();
}
+struct convertible_to_piecewise {
+ operator boost::unordered::piecewise_construct_t() const {
+ return boost::unordered::piecewise_construct;
+ }
+};
+
UNORDERED_AUTO_TEST(map_emplace_test2)
{
boost::unordered_map<overloaded_constructor, overloaded_constructor> x;
@@ -706,7 +712,7 @@
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
x.find(overloaded_constructor())->second == overloaded_constructor());
- x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(1), boost::make_tuple());
+ x.emplace(convertible_to_piecewise(), boost::make_tuple(1), boost::make_tuple());
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
x.find(overloaded_constructor(1))->second == overloaded_constructor());
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk