Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73592 - in trunk: boost/unordered boost/unordered/detail libs/unordered/test/objects libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-08-07 04:55:30


Author: danieljames
Date: 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
New Revision: 73592
URL: http://svn.boost.org/trac/boost/changeset/73592

Log:
Unordered: Better std::forward/move configuration.
Text files modified:
   trunk/boost/unordered/detail/buckets.hpp | 4 ++--
   trunk/boost/unordered/detail/equivalent.hpp | 2 +-
   trunk/boost/unordered/detail/extract_key.hpp | 4 ++--
   trunk/boost/unordered/detail/unique.hpp | 2 +-
   trunk/boost/unordered/detail/util.hpp | 19 +++++++++++++++----
   trunk/boost/unordered/unordered_map.hpp | 8 ++++----
   trunk/boost/unordered/unordered_set.hpp | 8 ++++----
   trunk/libs/unordered/test/objects/exception.hpp | 2 +-
   trunk/libs/unordered/test/objects/minimal.hpp | 2 +-
   trunk/libs/unordered/test/objects/test.hpp | 2 +-
   trunk/libs/unordered/test/unordered/unnecessary_copy_tests.cpp | 12 ++++++------
   11 files changed, 38 insertions(+), 27 deletions(-)

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -424,7 +424,7 @@
     ////////////////////////////////////////////////////////////////////////////
     // Node Constructors
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
     template <class T, class... Args>
     inline void construct_impl(T*, void* address, Args&&... args)
@@ -495,7 +495,7 @@
         ~node_constructor();
         void construct_preamble();
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         void construct(Args&&... args)
         {

Modified: trunk/boost/unordered/detail/equivalent.hpp
==============================================================================
--- trunk/boost/unordered/detail/equivalent.hpp (original)
+++ trunk/boost/unordered/detail/equivalent.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -200,7 +200,7 @@
                 this->find_node(bucket_index, hash, k));
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
         template <class... Args>
         node_ptr emplace(Args&&... args)

Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -43,7 +43,7 @@
             return no_key();
         }
         
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         static no_key extract(Args const&...)
         {
@@ -99,7 +99,7 @@
             return v.first;
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class Arg1, class... Args>
         static key_type const& extract(key_type const& k,
             Arg1 const&, Args const&...)

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -186,7 +186,7 @@
         }
 
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
         template<class... Args>
         emplace_return emplace(Args&&... args)

Modified: trunk/boost/unordered/detail/util.hpp
==============================================================================
--- trunk/boost/unordered/detail/util.hpp (original)
+++ trunk/boost/unordered/detail/util.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -41,9 +41,20 @@
 #if !defined(BOOST_NO_RVALUE_REFERENCES) && \
         !defined(BOOST_NO_VARIADIC_TEMPLATES)
 # if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
- // STLport doesn't have std::forward.
-# else
-# define BOOST_UNORDERED_STD_FORWARD
+# 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)
+ // Visual C++. A version check would be a good idea.
+# define BOOST_UNORDERED_STD_FORWARD_MOVE
 # endif
 #endif
 
@@ -51,7 +62,7 @@
 #define BOOST_UNORDERED_EMPLACE_LIMIT 10
 #endif
 
-#if !defined(BOOST_UNORDERED_STD_FORWARD)
+#if !defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>

Modified: trunk/boost/unordered/unordered_map.hpp
==============================================================================
--- trunk/boost/unordered/unordered_map.hpp (original)
+++ trunk/boost/unordered/unordered_map.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -216,7 +216,7 @@
 
         // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         std::pair<iterator, bool> emplace(Args&&...);
         template <class... Args>
@@ -563,7 +563,7 @@
 
         // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         iterator emplace(Args&&...);
         template <class... Args>
@@ -840,7 +840,7 @@
 
     // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
     template <class K, class T, class H, class P, class A>
     template <class... Args>
     std::pair<BOOST_DEDUCED_TYPENAME unordered_map<K,T,H,P,A>::iterator, bool>
@@ -1279,7 +1279,7 @@
 
     // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
     template <class K, class T, class H, class P, class A>
     template <class... Args>

Modified: trunk/boost/unordered/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set.hpp (original)
+++ trunk/boost/unordered/unordered_set.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -213,7 +213,7 @@
 
         // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         std::pair<iterator, bool> emplace(Args&&...);
         template <class... Args>
@@ -540,7 +540,7 @@
 
         // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template <class... Args>
         iterator emplace(Args&&...);
         template <class... Args>
@@ -805,7 +805,7 @@
 
     // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
     template <class T, class H, class P, class A>
     template <class... Args>
     std::pair<BOOST_DEDUCED_TYPENAME unordered_set<T,H,P,A>::iterator, bool>
@@ -1190,7 +1190,7 @@
 
     // modifiers
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
 
     template <class T, class H, class P, class A>
     template <class... Args>

Modified: trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/exception.hpp (original)
+++ trunk/libs/unordered/test/objects/exception.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -347,7 +347,7 @@
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template<class... Args> void construct(pointer p, Args&&... args) {
             UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
                 UNORDERED_EPOINT("Mock allocator construct function.");

Modified: trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ trunk/libs/unordered/test/objects/minimal.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -280,7 +280,7 @@
 
         void construct(pointer p, T const& t) { new((void*)p.ptr_) T(t); }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template<class... Args> void construct(pointer p, Args&&... args) {
             new((void*)p.ptr_) T(std::forward<Args>(args)...);
         }

Modified: trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/test.hpp (original)
+++ trunk/libs/unordered/test/objects/test.hpp 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -273,7 +273,7 @@
             new(p) T(t);
         }
 
-#if defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         template<class... Args> void construct(pointer p, Args&&... args) {
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
             new(p) T(std::forward<Args>(args)...);

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 2011-08-07 04:55:28 EDT (Sun, 07 Aug 2011)
@@ -143,7 +143,7 @@
         reset();
         T x;
         x.emplace(source<BOOST_DEDUCED_TYPENAME T::value_type>());
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         COPY_COUNT(1);
 #else
         COPY_COUNT(2);
@@ -155,7 +155,7 @@
     UNORDERED_TEST(unnecessary_copy_emplace_rvalue_test,
             ((set)(multiset)(map)(multimap)))
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
     template <class T>
     void unnecessary_copy_emplace_move_test(T*)
     {
@@ -193,7 +193,7 @@
         BOOST_DEDUCED_TYPENAME T::value_type a;
         COPY_COUNT(1); MOVE_COUNT(0);
         x.emplace(boost::move(a));
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if defined(BOOST_NO_RVALUE_REFERENCES)
         COPY_COUNT(1); MOVE_COUNT(1);
 #else
         COPY_COUNT(2); MOVE_COUNT(0);
@@ -219,7 +219,7 @@
         // the existing element.
         reset();
         x.emplace();
-#if !defined(BOOST_UNORDERED_STD_FORWARD)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         // TODO: I think that in this case the move could be delayed until
         // after checking for a collision, giving MOVE_COUNT(0).
         COPY_COUNT(1); MOVE_COUNT(1);
@@ -243,7 +243,7 @@
         x.emplace(source<count_copies>());
         COPY_COUNT(1); MOVE_COUNT(0);
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         // No move should take place.
         reset();
         x.emplace(std::move(a));
@@ -315,7 +315,7 @@
         //x.emplace(a_ref);
         //COPY_COUNT(0); MOVE_COUNT(0);
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
         // No move should take place.
         // (since a is already in the container)
         reset();


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