Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78536 - in trunk: boost/unordered boost/unordered/detail libs/unordered/test/objects libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2012-05-21 18:15:36


Author: danieljames
Date: 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
New Revision: 78536
URL: http://svn.boost.org/trac/boost/changeset/78536

Log:
Unordered: Use Boost.Move in a few more places.

Should be better for compilers with variadic parameters, but no rvalue
references. If such a thing ever exists.
Text files modified:
   trunk/boost/unordered/detail/allocate.hpp | 27 +++++++++++----------------
   trunk/boost/unordered/detail/buckets.hpp | 2 +-
   trunk/boost/unordered/detail/equivalent.hpp | 9 +++++++++
   trunk/boost/unordered/detail/extract_key.hpp | 10 +++++-----
   trunk/boost/unordered/detail/unique.hpp | 16 ++++++++++++----
   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 | 6 +++---
   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 | 19 +------------------
   12 files changed, 62 insertions(+), 67 deletions(-)

Modified: trunk/boost/unordered/detail/allocate.hpp
==============================================================================
--- trunk/boost/unordered/detail/allocate.hpp (original)
+++ trunk/boost/unordered/detail/allocate.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -45,11 +45,6 @@
 
 #define BOOST_UNORDERED_EMPLACE_LIMIT 10
 
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && \
- !defined(BOOST_NO_VARIADIC_TEMPLATES)
-#define BOOST_UNORDERED_VARIADIC_MOVE
-#endif
-
 namespace boost { namespace unordered { namespace detail {
 
     ////////////////////////////////////////////////////////////////////////////
@@ -90,10 +85,10 @@
     // Either forwarding variadic arguments, or storing the arguments in
     // emplace_args##n
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
 
 #define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args
-#define BOOST_UNORDERED_EMPLACE_ARGS Args&&... args
+#define BOOST_UNORDERED_EMPLACE_ARGS BOOST_FWD_REF(Args)... args
 #define BOOST_UNORDERED_EMPLACE_FORWARD boost::forward<Args>(args)...
 
 #else
@@ -330,13 +325,13 @@
 
 #endif
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
 
     ////////////////////////////////////////////////////////////////////////////
     // Construct from variadic parameters
 
     template <typename T, typename... Args>
- inline void construct_impl(T* address, Args&&... args)
+ inline void construct_impl(T* address, BOOST_FWD_REF(Args)... args)
     {
         new((void*) address) T(boost::forward<Args>(args)...);
     }
@@ -387,7 +382,7 @@
     }
 
 #endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
-#else // BOOST_UNORDERED_VARIADIC_MOVE
+#else // BOOST_NO_VARIADIC_TEMPLATES
 
 ////////////////////////////////////////////////////////////////////////////////
 // Construct from emplace_args
@@ -499,7 +494,7 @@
 #undef BOOST_UNORDERED_CALL_FORWARD2
 
 #endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
-#endif // BOOST_UNORDERED_VARIADIC_MOVE
+#endif // BOOST_NO_VARIADIC_TEMPLATES
 
     ////////////////////////////////////////////////////////////////////////////
     // Construct without using the emplace args mechanism.
@@ -525,7 +520,7 @@
 #if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
 # if defined(__GXX_EXPERIMENTAL_CXX0X__) && \
             (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
-# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1
+# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0
 # elif defined(BOOST_MSVC)
 # if BOOST_MSVC < 1400
             // Use container's allocator_traits for older versions of Visual
@@ -689,7 +684,7 @@
 # include <boost/type_traits/is_same.hpp>
 # endif
 
-# if defined(BOOST_UNORDERED_VARIADIC_MOVE) && \
+# if !defined(BOOST_NO_VARIADIC_TEMPLATES) && \
         !defined(BOOST_NO_SFINAE_EXPR)
 # define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1
 # else
@@ -779,7 +774,7 @@
         max_size, U const, (), 0
     );
 
-# if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+# if !defined(BOOST_NO_VARIADIC_TEMPLATES)
 
     template <typename T, typename ValueType, typename... Args>
     BOOST_UNORDERED_HAS_FUNCTION(
@@ -906,7 +901,7 @@
         static typename boost::enable_if_c<
                 boost::unordered::detail::has_construct<Alloc, T, Args...>
                 ::value>::type
- construct(Alloc& a, T* p, Args&&... x)
+ construct(Alloc& a, T* p, BOOST_FWD_REF(Args)... x)
         {
             a.construct(p, boost::forward<Args>(x)...);
         }
@@ -915,7 +910,7 @@
         static typename boost::disable_if_c<
                 boost::unordered::detail::has_construct<Alloc, T, Args...>
                 ::value>::type
- construct(Alloc&, T* p, Args&&... x)
+ construct(Alloc&, T* p, BOOST_FWD_REF(Args)... x)
         {
             new ((void*) p) T(boost::forward<Args>(x)...);
         }

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -82,7 +82,7 @@
         void construct_value2(BOOST_FWD_REF(A0) a0)
         {
             BOOST_ASSERT(node_ && !constructed_);
-# if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+# if !defined(BOOST_NO_VARIADIC_TEMPLATES)
             boost::unordered::detail::construct_node(alloc_,
                 boost::addressof(*node_), boost::forward<A0>(a0));
 # else

Modified: trunk/boost/unordered/detail/equivalent.hpp
==============================================================================
--- trunk/boost/unordered/detail/equivalent.hpp (original)
+++ trunk/boost/unordered/detail/equivalent.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -497,12 +497,21 @@
         }
 
 #if defined(BOOST_NO_RVALUE_REFERENCES)
+# if defined(BOOST_NO_VARIADIC_TEMPLATES)
         iterator emplace(boost::unordered::detail::emplace_args1<
                 boost::unordered::detail::please_ignore_this_overload> const&)
         {
             BOOST_ASSERT(false);
             return iterator();
         }
+# else
+ iterator emplace(
+ boost::unordered::detail::please_ignore_this_overload const&)
+ {
+ BOOST_ASSERT(false);
+ return iterator();
+ }
+# endif
 #endif
 
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>

Modified: trunk/boost/unordered/detail/extract_key.hpp
==============================================================================
--- trunk/boost/unordered/detail/extract_key.hpp (original)
+++ trunk/boost/unordered/detail/extract_key.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -56,7 +56,7 @@
             return no_key();
         }
         
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class... Args>
         static no_key extract(Args const&...)
         {
@@ -111,7 +111,7 @@
             return v.first;
         }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class Arg1, class... Args>
         static key_type const& extract(key_type const& k,
             Arg1 const&, Args const&...)
@@ -150,12 +150,12 @@
         }
 #endif
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
 
 #define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
         template <typename T2> \
         static no_key extract(boost::unordered::piecewise_construct_t, \
- namespace_::tuple<> const&, T2&&) \
+ namespace_::tuple<> const&, BOOST_FWD_REF(T2)) \
         { \
             return no_key(); \
         } \
@@ -163,7 +163,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, T2&&) \
+ namespace_::tuple<T> const& k, BOOST_FWD_REF(T2)) \
         { \
             return typename is_key<key_type, T>::type( \
                 namespace_::get<0>(k)); \

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -379,7 +379,7 @@
             // exception (need strong safety in such a case).
             node_constructor a(this->node_alloc());
             a.construct_node();
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
             a.construct_value(boost::unordered::piecewise_construct,
                 boost::make_tuple(k), boost::make_tuple());
 #else
@@ -395,22 +395,30 @@
         }
 
 #if defined(BOOST_NO_RVALUE_REFERENCES)
+# if defined(BOOST_NO_VARIADIC_TEMPLATES)
         emplace_return emplace(boost::unordered::detail::emplace_args1<
                 boost::unordered::detail::please_ignore_this_overload> const&)
         {
             BOOST_ASSERT(false);
             return emplace_return(this->begin(), false);
         }
+# else
+ emplace_return emplace(
+ boost::unordered::detail::please_ignore_this_overload const&)
+ {
+ BOOST_ASSERT(false);
+ return emplace_return(this->begin(), false);
+ }
+# endif
 #endif
 
         template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
         emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS)
         {
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
             return emplace_impl(
                 extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
                 BOOST_UNORDERED_EMPLACE_FORWARD);
-
 #else
             return emplace_impl(
                 extractor::extract(args.a0, args.a1),
@@ -418,7 +426,7 @@
 #endif
         }
 
-#if !defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if defined(BOOST_NO_VARIADIC_TEMPLATES)
         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-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -232,15 +232,15 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class... Args>
- std::pair<iterator, bool> emplace(Args&&... args)
+ std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
- iterator emplace_hint(const_iterator, Args&&... args)
+ iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...).first;
         }
@@ -719,15 +719,15 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class... Args>
- iterator emplace(Args&&... args)
+ iterator emplace(BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
- iterator emplace_hint(const_iterator, Args&&... args)
+ iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }

Modified: trunk/boost/unordered/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered/unordered_set.hpp (original)
+++ trunk/boost/unordered/unordered_set.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -230,15 +230,15 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class... Args>
- std::pair<iterator, bool> emplace(Args&&... args)
+ std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
- iterator emplace_hint(const_iterator, Args&&... args)
+ iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...).first;
         }
@@ -703,15 +703,15 @@
 
         // emplace
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         template <class... Args>
- iterator emplace(Args&&... args)
+ iterator emplace(BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }
 
         template <class... Args>
- iterator emplace_hint(const_iterator, Args&&... args)
+ iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args)
         {
             return table_.emplace(boost::forward<Args>(args)...);
         }

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-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -168,8 +168,8 @@
             new(p) T(t);
         }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
- template<typename... Args> void construct(T* p, Args&&... args) {
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template<typename... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
             new(p) T(boost::forward<Args>(args)...);
         }

Modified: trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/exception.hpp (original)
+++ trunk/libs/unordered/test/objects/exception.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -357,9 +357,9 @@
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
         }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
- template<class... Args> void construct(T* p, Args&&... args) {
- UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
+ UNORDERED_SCOPE(allocator::construct(pointer, BOOST_FWD_REF(Args)...)) {
                 UNORDERED_EPOINT("Mock allocator construct function.");
                 new(p) T(boost::forward<Args>(args)...);
             }

Modified: trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ trunk/libs/unordered/test/objects/minimal.hpp 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -367,8 +367,8 @@
 
         void construct(T* p, T const& t) { new((void*)p) T(t); }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
- template<class... Args> void construct(T* p, Args&&... args) {
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
             new((void*)p) T(boost::forward<Args>(args)...);
         }
 #endif
@@ -439,8 +439,8 @@
 
         void construct(T* p, T const& t) { new((void*)p) T(t); }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
- template<class... Args> void construct(T* p, Args&&... args) {
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template<class... Args> void construct(T* p, BOOST_FWD_REF(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-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -259,8 +259,8 @@
             new(p) T(t);
         }
 
-#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
- template<class... Args> void construct(T* p, Args&&... args) {
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
             new(p) T(boost::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 2012-05-21 18:15:33 EDT (Mon, 21 May 2012)
@@ -11,23 +11,6 @@
 #include <iostream>
 #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
@@ -262,7 +245,7 @@
         // the existing element.
         reset();
         x.emplace();
-#if !defined(BOOST_NO_RVALUE_REFERENCES)
+#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
         // 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