Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74181 - in trunk: boost/unordered/detail libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-08-31 18:57:57


Author: danieljames
Date: 2011-08-31 18:57:57 EDT (Wed, 31 Aug 2011)
New Revision: 74181
URL: http://svn.boost.org/trac/boost/changeset/74181

Log:
Unordered: Deprecate variadic pair construction emulation.
Text files modified:
   trunk/boost/unordered/detail/buckets.hpp | 50 ++++++++++++++++++++++++++-------------
   trunk/libs/unordered/test/unordered/Jamfile.v2 | 3 ++
   trunk/libs/unordered/test/unordered/insert_tests.cpp | 10 ++++---
   3 files changed, 42 insertions(+), 21 deletions(-)

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2011-08-31 18:57:57 EDT (Wed, 31 Aug 2011)
@@ -549,6 +549,7 @@
 BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1)
 #endif
 
+#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
     template <typename A, typename B, typename Arg1>
     struct emulation1 {
         static choice1::type check(choice1, std::pair<A, B> const&);
@@ -556,45 +557,58 @@
 
         enum { value = sizeof(check(choose(), make<Arg1>())) == sizeof(choice2::type) };
     };
+#endif
 
+#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
     template <typename A, typename B, typename Arg1>
- struct piecewise3 {
+ struct check3_base {
         static choice1::type check(choice1, boost::unordered::piecewise_construct_t);
         static choice2::type check(choice2, A const&);
         static choice3::type check(choice3, ...);
-
- enum { value = sizeof(check(choose(), make<Arg1>())) == sizeof(choice1::type) };
     };
-
+#else
     template <typename A, typename B, typename Arg1>
- struct emulation3 {
+ struct check3_base {
         static choice1::type check(choice1, boost::unordered::piecewise_construct_t);
- static choice2::type check(choice2, A const&);
         static choice3::type check(choice3, ...);
+ };
+#endif
 
- enum { value = sizeof(check(choose(), make<Arg1>())) == sizeof(choice2::type) };
+ template <typename A, typename B, typename Arg1>
+ struct piecewise3 {
+ enum { value =
+ sizeof(check3_base<A,B,Arg1>::check(choose(), make<Arg1>())) ==
+ sizeof(choice1::type) };
     };
 
     template <typename A, typename B, typename Arg1>
- struct normal3 {
- static choice1::type check(choice1, boost::unordered::piecewise_construct_t);
- static choice2::type check(choice2, A const&);
- static choice3::type check(choice3, ...);
+ struct emulation3 {
+ enum { value =
+ sizeof(check3_base<A,B,Arg1>::check(choose(), make<Arg1>())) ==
+ sizeof(choice2::type) };
+ };
 
- enum { value = sizeof(check(choose(), make<Arg1>())) == sizeof(choice3::type) };
+ template <typename A, typename B, typename Arg1>
+ struct normal3 {
+ enum { value =
+ sizeof(check3_base<A,B,Arg1>::check(choose(), make<Arg1>())) ==
+ sizeof(choice3::type) };
     };
 
     template <typename T, typename Arg1>
     struct pair_construct1 {};
+ template <typename T, typename Arg1>
+ struct normal_construct1 { typedef void type; };
+
+#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
     template <typename A, typename B, typename Arg1>
     struct pair_construct1<std::pair<A, B>, Arg1>
         : enable_if<emulation1<A, B, Arg1>, void> {};
 
- template <typename T, typename Arg1>
- struct normal_construct1 { typedef void type; };
     template <typename A, typename B, typename Arg1>
     struct normal_construct1<std::pair<A, B>, Arg1>
         : disable_if<emulation1<A, B, Arg1>, void> {};
+#endif
 
     template <typename T, typename Arg1>
     struct piecewise_construct3 {};
@@ -616,13 +630,15 @@
 
     template <typename T>
     struct pair_construct_n {};
- template <typename A, typename B>
- struct pair_construct_n<std::pair<A, B> > { typedef void type; };
-
     template <typename T>
     struct normal_construct_n { typedef void type; };
+
+#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
+ template <typename A, typename B>
+ struct pair_construct_n<std::pair<A, B> > { typedef void type; };
     template <typename A, typename B>
     struct normal_construct_n<std::pair<A, B> > {};
+#endif
 
     template <class T>
     inline void construct_impl(void* address)

Modified: trunk/libs/unordered/test/unordered/Jamfile.v2
==============================================================================
--- trunk/libs/unordered/test/unordered/Jamfile.v2 (original)
+++ trunk/libs/unordered/test/unordered/Jamfile.v2 2011-08-31 18:57:57 EDT (Wed, 31 Aug 2011)
@@ -35,6 +35,9 @@
         [ run move_tests.cpp ]
         [ run assign_tests.cpp ]
         [ run insert_tests.cpp ]
+ [ run insert_tests.cpp : :
+ : <define>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
+ : insert_deprecated ]
         [ run insert_stable_tests.cpp ]
         [ run unnecessary_copy_tests.cpp ]
         [ run erase_tests.cpp ]

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 2011-08-31 18:57:57 EDT (Wed, 31 Aug 2011)
@@ -545,14 +545,15 @@
     BOOST_TEST(x.find(0) != x.end() &&
         x.find(0)->second == overloaded_constructor());
 
- x.emplace(1);
- BOOST_TEST(x.find(1) != x.end() &&
- x.find(1)->second == overloaded_constructor());
-
     x.emplace(2, 3);
     BOOST_TEST(x.find(2) != x.end() &&
         x.find(2)->second == overloaded_constructor(3));
 
+#if defined (BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
+ x.emplace(1);
+ BOOST_TEST(x.find(1) != x.end() &&
+ x.find(1)->second == overloaded_constructor());
+
     x.emplace(4, 5, 6);
     BOOST_TEST(x.find(4) != x.end() &&
         x.find(4)->second == overloaded_constructor(5, 6));
@@ -560,6 +561,7 @@
     x.emplace(7, 8, 9, 10);
     BOOST_TEST(x.find(7) != x.end() &&
         x.find(7)->second == overloaded_constructor(8, 9, 10));
+#endif
 }
 
 UNORDERED_AUTO_TEST(set_emplace_test)


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