Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76331 - in trunk: boost/unordered boost/unordered/detail libs/unordered/test/objects libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2012-01-06 03:36:45


Author: danieljames
Date: 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
New Revision: 76331
URL: http://svn.boost.org/trac/boost/changeset/76331

Log:
Unordered: Use Boost.Move for variadic forwarding.
Text files modified:
   trunk/boost/unordered/detail/emplace_args.hpp | 45 ++++++++++++++-------------------------
   trunk/boost/unordered/detail/extract_key.hpp | 6 ++--
   trunk/boost/unordered/detail/unique.hpp | 6 ++--
   trunk/boost/unordered/unordered_map.hpp | 12 +++++-----
   trunk/boost/unordered/unordered_set.hpp | 12 +++++-----
   trunk/libs/unordered/test/objects/cxx11_allocator.hpp | 4 +-
   trunk/libs/unordered/test/objects/exception.hpp | 4 +-
   trunk/libs/unordered/test/objects/minimal.hpp | 8 +++---
   trunk/libs/unordered/test/objects/test.hpp | 4 +-
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 21 ++++++++++++++++--
   10 files changed, 62 insertions(+), 60 deletions(-)

Modified: trunk/boost/unordered/detail/emplace_args.hpp
==============================================================================
--- trunk/boost/unordered/detail/emplace_args.hpp (original)
+++ trunk/boost/unordered/detail/emplace_args.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -40,20 +40,7 @@
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && \
         !defined(BOOST_NO_VARIADIC_TEMPLATES)
-# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
-# elif defined(_LIBCPP_VERSION)
-# define BOOST_UNORDERED_STD_FORWARD_MOVE
-# elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
-# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20090804
-# define BOOST_UNORDERED_STD_FORWARD_MOVE
-# endif
-# elif defined(__STL_CONFIG_H)
-# elif defined(__MSL_CPP__)
-# elif defined(__IBMCPP__)
-# elif defined(MSIPL_COMPILE_H)
-# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
-# endif
+#define BOOST_UNORDERED_VARIADIC_MOVE
 #endif
 
 namespace boost { namespace unordered { namespace detail {
@@ -64,11 +51,11 @@
     // Either forwarding variadic arguments, or storing the arguments in
     // emplace_args##n
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
 
 #define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args
 #define BOOST_UNORDERED_EMPLACE_ARGS Args&&... args
-#define BOOST_UNORDERED_EMPLACE_FORWARD std::forward<Args>(args)...
+#define BOOST_UNORDERED_EMPLACE_FORWARD boost::forward<Args>(args)...
 
 #else
 
@@ -302,7 +289,7 @@
 
 #endif
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
 
     ////////////////////////////////////////////////////////////////////////////
     // Construct from variadic parameters
@@ -310,7 +297,7 @@
     template <typename T, typename... Args>
     inline void construct_impl(T* address, Args&&... args)
     {
- new((void*) address) T(std::forward<Args>(args)...);
+ new((void*) address) T(boost::forward<Args>(args)...);
     }
 
     template <typename A, typename B, typename A0, typename A1, typename A2>
@@ -329,7 +316,7 @@
     inline typename enable_if<emulation1<A, B, A0>, void>::type
         construct_impl(std::pair<A, B>* address, A0&& a0)
     {
- new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
+ new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
         new((void*) boost::addressof(address->second)) B();
    }
 
@@ -337,10 +324,10 @@
     inline typename enable_if<emulation3<A, B, A0>, void>::type
         construct_impl(std::pair<A, B>* address, A0&& a0, A1&& a1, A2&& a2)
     {
- new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
+ new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
         new((void*) boost::addressof(address->second)) B(
- std::forward<A1>(a1),
- std::forward<A2>(a2));
+ boost::forward<A1>(a1),
+ boost::forward<A2>(a2));
     }
 
     template <typename A, typename B,
@@ -349,17 +336,17 @@
     inline void construct_impl(std::pair<A, B>* address,
             A0&& a0, A1&& a1, A2&& a2, A3&& a3, Args&&... args)
     {
- new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
+ new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
 
         new((void*) boost::addressof(address->second)) B(
- std::forward<A1>(a1),
- std::forward<A2>(a2),
- std::forward<A3>(a3),
- std::forward<Args>(args)...);
+ boost::forward<A1>(a1),
+ boost::forward<A2>(a2),
+ boost::forward<A3>(a3),
+ boost::forward<Args>(args)...);
     }
 
 #endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
-#else // BOOST_UNORDERED_STD_FORWARD_MOVE
+#else // BOOST_UNORDERED_VARIADIC_MOVE
 
 ////////////////////////////////////////////////////////////////////////////////
 // Construct from emplace_args
@@ -471,7 +458,7 @@
 #undef BOOST_UNORDERED_CALL_FORWARD2
 
 #endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
-#endif // BOOST_UNORDERED_STD_FORWARD_MOVE
+#endif // BOOST_UNORDERED_VARIADIC_MOVE
 
     ////////////////////////////////////////////////////////////////////////////
     // Construct without using the emplace args mechanism.

Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -63,7 +63,7 @@
             return no_key();
         }
         
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class... Args>
         static no_key extract(Args const&...)
         {
@@ -126,7 +126,7 @@
             return v.first;
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class Arg1, class... Args>
         static key_type const& extract(key_type const& k,
             Arg1 const&, Args const&...)
@@ -165,7 +165,7 @@
         }
 #endif
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
 
 #define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
         template <typename T2> \

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -337,7 +337,7 @@
             // exception (need strong safety in such a case).
             node_constructor a(this->node_alloc());
             a.construct_node();
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
             a.construct_value(boost::unordered::piecewise_construct,
                 boost::make_tuple(k), boost::make_tuple());
 #else
@@ -364,7 +364,7 @@
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
         emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS)
         {
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
             return emplace_impl(
                 extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
                 BOOST_UNORDERED_EMPLACE_FORWARD);
@@ -376,7 +376,7 @@
 #endif
         }
 
-#if !defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if !defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <typename A0>
         emplace_return emplace(
                 boost::unordered::detail::emplace_args1<A0> const& args)

Modified: trunk/boost/unordered/unordered_map.hpp
==============================================================================
--- trunk/boost/unordered/unordered_map.hpp (original)
+++ trunk/boost/unordered/unordered_map.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -233,17 +233,17 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class... Args>
         std::pair<iterator, bool> emplace(Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
         iterator emplace_hint(const_iterator, Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...).first;
+ return table_.emplace(boost::forward<Args>(args)...).first;
         }
 #else
 
@@ -718,17 +718,17 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class... Args>
         iterator emplace(Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
         iterator emplace_hint(const_iterator, Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 #else
 

Modified: trunk/boost/unordered/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set.hpp (original)
+++ trunk/boost/unordered/unordered_set.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -231,17 +231,17 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class... Args>
         std::pair<iterator, bool> emplace(Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
         iterator emplace_hint(const_iterator, Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...).first;
+ return table_.emplace(boost::forward<Args>(args)...).first;
         }
 #else
 
@@ -702,17 +702,17 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template <class... Args>
         iterator emplace(Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
         iterator emplace_hint(const_iterator, Args&&... args)
         {
- return table_.emplace(std::forward<Args>(args)...);
+ return table_.emplace(boost::forward<Args>(args)...);
         }
 #else
 

Modified: trunk/libs/unordered/test/objects/cxx11_allocator.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/cxx11_allocator.hpp (original)
+++ trunk/libs/unordered/test/objects/cxx11_allocator.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -168,10 +168,10 @@
             new(p) T(t);
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template<typename... Args> void construct(T* p, Args&&... args) {
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
- new(p) T(std::forward<Args>(args)...);
+ new(p) T(boost::forward<Args>(args)...);
         }
 #endif
 

Modified: trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/exception.hpp (original)
+++ trunk/libs/unordered/test/objects/exception.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -357,11 +357,11 @@
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template<class... Args> void construct(T* p, Args&&... args) {
             UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
                 UNORDERED_EPOINT("Mock allocator construct function.");
- new(p) T(std::forward<Args>(args)...);
+ new(p) T(boost::forward<Args>(args)...);
             }
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
         }

Modified: trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ trunk/libs/unordered/test/objects/minimal.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -367,9 +367,9 @@
 
         void construct(T* p, T const& t) { new((void*)p) T(t); }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template<class... Args> void construct(T* p, Args&&... args) {
- new((void*)p) T(std::forward<Args>(args)...);
+ new((void*)p) T(boost::forward<Args>(args)...);
         }
 #endif
 
@@ -439,9 +439,9 @@
 
         void construct(T* p, T const& t) { new((void*)p) T(t); }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template<class... Args> void construct(T* p, Args&&... args) {
- new((void*)p) T(std::forward<Args>(args)...);
+ new((void*)p) T(boost::forward<Args>(args)...);
         }
 #endif
 

Modified: trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/test.hpp (original)
+++ trunk/libs/unordered/test/objects/test.hpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -259,10 +259,10 @@
             new(p) T(t);
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
         template<class... Args> void construct(T* p, Args&&... args) {
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
- new(p) T(std::forward<Args>(args)...);
+ new(p) T(boost::forward<Args>(args)...);
         }
 #endif
 

Modified: trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp 2012-01-06 03:36:43 EST (Fri, 06 Jan 2012)
@@ -9,6 +9,23 @@
 #include <boost/unordered_map.hpp>
 #include "../helpers/test.hpp"
 
+#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
+# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
+# elif defined(_LIBCPP_VERSION)
+# define BOOST_UNORDERED_VARIADIC_MOVE
+# elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20090804
+# define BOOST_UNORDERED_VARIADIC_MOVE
+# endif
+# elif defined(__STL_CONFIG_H)
+# elif defined(__MSL_CPP__)
+# elif defined(__IBMCPP__)
+# elif defined(MSIPL_COMPILE_H)
+# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
+# endif
+#endif
+
 namespace unnecessary_copy_tests
 {
     struct count_copies
@@ -243,9 +260,7 @@
         // the existing element.
         reset();
         x.emplace();
-#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
- COPY_COUNT(1); MOVE_COUNT(0);
-#elif !defined(BOOST_NO_RVALUE_REFERENCES)
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
         // source_cost doesn't make much sense here, but it seems to fit.
         COPY_COUNT(1); MOVE_COUNT(source_cost);
 #else


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