forked from boostorg/fusion
Added move ctors for vector and deque (deque for gcc partially working for now)
no preprocessed files yet [SVN r80331]
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
@ -12,11 +12,14 @@
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define FUSION_FORWARD_CTOR_MOVE(z, n, _) std::move(_##n)
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/vector/detail/vector_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_FORWARD_CTOR_MOVE
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -34,6 +37,14 @@
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
: vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if N == 1
|
||||
explicit
|
||||
#endif
|
||||
vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
|
||||
: vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {}
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
@ -12,7 +12,10 @@
|
||||
#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_MEMBER_ASSIGN(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
|
||||
@ -42,6 +45,11 @@
|
||||
BOOST_PP_CAT(vector_data, N)()
|
||||
: BOOST_PP_ENUM(N, FUSION_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, _) {}
|
||||
#endif
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
@ -51,6 +59,12 @@
|
||||
BOOST_PP_CAT(vector_data, N) const& other)
|
||||
: BOOST_PP_ENUM(N, FUSION_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, _) {}
|
||||
#endif
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)&
|
||||
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
|
||||
{
|
||||
@ -105,6 +119,19 @@
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if (N == 1)
|
||||
explicit
|
||||
#endif
|
||||
BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _))
|
||||
: base_type(BOOST_PP_ENUM(N, FUSION_FORWARD, _)) {}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
|
||||
: base_type(std::move(rhs)) {}
|
||||
#endif
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
|
||||
BOOST_PP_CAT(vector, N)(
|
||||
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
|
||||
@ -166,3 +193,4 @@
|
||||
|
||||
#undef N
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user