Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80345 - in trunk/boost/fusion/container: deque deque/detail vector vector/detail
From: joel_at_[hidden]
Date: 2012-08-31 22:01:27


Author: djowel
Date: 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
New Revision: 80345
URL: http://svn.boost.org/trac/boost/changeset/80345

Log:
move-assign for vector
Text files modified:
   trunk/boost/fusion/container/deque/deque.hpp | 7 ----
   trunk/boost/fusion/container/deque/detail/cpp03_deque.hpp | 9 -----
   trunk/boost/fusion/container/deque/detail/keyed_element.hpp | 8 ----
   trunk/boost/fusion/container/vector/detail/vector_n.hpp | 65 ++++++++++++++++++++++++----------------
   trunk/boost/fusion/container/vector/vector.hpp | 19 +++++++++++
   5 files changed, 57 insertions(+), 51 deletions(-)

Modified: trunk/boost/fusion/container/deque/deque.hpp
==============================================================================
--- trunk/boost/fusion/container/deque/deque.hpp (original)
+++ trunk/boost/fusion/container/deque/deque.hpp 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
@@ -131,13 +131,6 @@
         }
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
- template <typename ...Elements>
- deque& operator=(deque<Elements...>&& rhs)
- {
- base::operator=(std::forward<deque<Elements...>>(rhs));
- return *this;
- }
-
         template <typename T>
         deque& operator=(T&& rhs)
         {

Modified: trunk/boost/fusion/container/deque/detail/cpp03_deque.hpp
==============================================================================
--- trunk/boost/fusion/container/deque/detail/cpp03_deque.hpp (original)
+++ trunk/boost/fusion/container/deque/detail/cpp03_deque.hpp 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
@@ -135,15 +135,6 @@
         }
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
- template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
- deque&
- operator=(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& rhs)
- {
- base::operator=(std::forward<
- deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>>(rhs));
- return *this;
- }
-
         template <typename T>
         deque&
         operator=(T&& rhs)

Modified: trunk/boost/fusion/container/deque/detail/keyed_element.hpp
==============================================================================
--- trunk/boost/fusion/container/deque/detail/keyed_element.hpp (original)
+++ trunk/boost/fusion/container/deque/detail/keyed_element.hpp 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
@@ -124,14 +124,6 @@
         }
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
- template<typename U, typename Rst>
- keyed_element& operator=(keyed_element<Key, U, Rst>&& rhs)
- {
- base::operator=(std::forward<keyed_element<Key, U, Rst>>(rhs));
- value_ = std::forward<U>(rhs.value_);
- return *this;
- }
-
         keyed_element& operator=(keyed_element&& rhs)
         {
             base::operator=(std::forward<keyed_element>(rhs));

Modified: trunk/boost/fusion/container/vector/detail/vector_n.hpp
==============================================================================
--- trunk/boost/fusion/container/vector/detail/vector_n.hpp (original)
+++ trunk/boost/fusion/container/vector/detail/vector_n.hpp 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
@@ -9,27 +9,31 @@
 #if !defined(FUSION_MACRO_05042005)
 #define FUSION_MACRO_05042005
 
-#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n()
-#define FUSION_MEMBER_INIT(z, n, _) m##n(_##n)
-#define FUSION_COPY_INIT(z, n, _) m##n(other.m##n)
-#define FUSION_MOVE_FROM_OTHER(z, n, _) m##n(std::move(other.m##n))
-#define FUSION_MOVE(z, n, _) m##n(std::move(_##n))
-#define FUSION_MEMBER_DECL(z, n, _) T##n m##n;
-#define FUSION_FORWARD(z, n, _) std::forward<T##n>(_##n)
+#define FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT(z, n, _) m##n()
+#define FUSION_VECTOR_MEMBER_MEMBER_INIT(z, n, _) m##n(_##n)
+#define FUSION_VECTOR_MEMBER_COPY_INIT(z, n, _) m##n(other.m##n)
+#define FUSION_VECTOR_MEMBER_FWD(z, n, _) m##n(std::forward<T##n>(other.m##n))
+#define FUSION_VECTOR_ARG_FWD(z, n, _) m##n(std::forward<T##n>(_##n))
+#define FUSION_VECTOR_MEMBER_MEMBER_DECL(z, n, _) T##n m##n;
+#define FUSION_VECTOR_MEMBER_FORWARD(z, n, _) std::forward<T##n>(_##n)
 
-#define FUSION_MEMBER_ASSIGN(z, n, _) \
+#define FUSION_VECTOR_MEMBER_MEMBER_ASSIGN(z, n, _) \
     this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
 
-#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _) \
+#define FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN(z, n, _) \
     this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
 
-#define FUSION_AT_IMPL(z, n, _) \
+#define FUSION_VECTOR_MEMBER_MEMBER_FORWARD(z, n, _) \
+ this->BOOST_PP_CAT(m, n) = std::forward< \
+ BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
+
+#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _) \
     typename add_reference<T##n>::type \
         at_impl(mpl::int_<n>) { return this->m##n; } \
     typename add_reference<typename add_const<T##n>::type>::type \
         at_impl(mpl::int_<n>) const { return this->m##n; }
 
-#define FUSION_ITER_DECL_VAR(z, n, _) \
+#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
     typedef typename result_of::next< \
         BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \
     BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \
@@ -43,32 +47,32 @@
     struct BOOST_PP_CAT(vector_data, N)
     {
         BOOST_PP_CAT(vector_data, N)()
- : BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
+ : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_DEFAULT_INIT, _) {}
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
         BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
- : BOOST_PP_ENUM(N, FUSION_MOVE, _) {}
+ : BOOST_PP_ENUM(N, FUSION_VECTOR_ARG_FWD, _) {}
 #endif
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_ENUM_BINARY_PARAMS(
                 N, typename detail::call_param<T, >::type _))
- : BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
+ : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {}
 
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_CAT(vector_data, N) const& other)
- : BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {}
+ : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_COPY_INIT, _) {}
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
         BOOST_PP_CAT(vector_data, N)(
             BOOST_PP_CAT(vector_data, N)&& other)
- : BOOST_PP_ENUM(N, FUSION_MOVE_FROM_OTHER, _) {}
+ : BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FWD, _) {}
 #endif
 
         BOOST_PP_CAT(vector_data, N)&
         operator=(BOOST_PP_CAT(vector_data, N) const& vec)
         {
- BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -78,7 +82,7 @@
         {
             typedef typename result_of::begin<Sequence const>::type I0;
             I0 i0 = fusion::begin(seq);
- BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
+ BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
             return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
         }
 
@@ -88,11 +92,11 @@
         {
             typedef typename result_of::begin<Sequence>::type I0;
             I0 i0 = fusion::begin(seq);
- BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
+ BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
             return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
         }
 
- BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_DECL, _)
     };
 
     template <BOOST_PP_ENUM_PARAMS(N, typename T)>
@@ -124,12 +128,12 @@
         explicit
 #endif
         BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
- : base_type(BOOST_PP_ENUM(N, FUSION_FORWARD, _)) {}
+ : base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, _)) {}
 #endif
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
         BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
- : base_type(std::move(rhs)) {}
+ : base_type(std::forward<base_type>(rhs)) {}
 #endif
 
         template <BOOST_PP_ENUM_PARAMS(N, typename U)>
@@ -159,7 +163,7 @@
         BOOST_PP_CAT(vector, N)&
         operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
         {
- BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
             return *this;
         }
 
@@ -169,12 +173,21 @@
         {
             typedef typename result_of::begin<Sequence const>::type I0;
             I0 i0 = fusion::begin(seq);
- BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
- BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _)
+ BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN, _)
+ return *this;
+ }
+
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+ BOOST_PP_CAT(vector, N)&
+ operator=(BOOST_PP_CAT(vector, N)&& vec)
+ {
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_FORWARD, _)
             return *this;
         }
+#endif
 
- BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
+ BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
 
         template<typename I>
         typename add_reference<typename mpl::at<types, I>::type>::type

Modified: trunk/boost/fusion/container/vector/vector.hpp
==============================================================================
--- trunk/boost/fusion/container/vector/vector.hpp (original)
+++ trunk/boost/fusion/container/vector/vector.hpp 2012-08-31 22:01:26 EDT (Fri, 31 Aug 2012)
@@ -108,7 +108,7 @@
 
 #if !defined(BOOST_NO_RVALUE_REFERENCES)
         vector(vector&& rhs)
- : vec(std::move(rhs.vec)) {}
+ : vec(std::forward<vector_n>(rhs.vec)) {}
 #endif
 
         template <typename Sequence>
@@ -140,6 +140,23 @@
             return *this;
         }
 
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+ vector&
+ operator=(vector&& rhs)
+ {
+ vec = std::forward<vector_n>(rhs.vec);
+ return *this;
+ }
+
+ template <typename T>
+ vector&
+ operator=(T&& rhs)
+ {
+ vec = std::forward<T>(rhs);
+ return *this;
+ }
+#endif
+
         template <int N>
         typename add_reference<
             typename mpl::at_c<types, N>::type


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