forked from boostorg/fusion
Merge from trunk
[SVN r81061]
This commit is contained in:
1 parent
940c594d3e
commit
fc38122f0f
21 files changed
+525
-171
No files matched your search
@@ -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)
|
||||
|
||||
@@ -9,24 +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_MEMBER_DECL(z, n, _) T##n m##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) \
|
||||
@@ -40,21 +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_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_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;
|
||||
}
|
||||
|
||||
@@ -64,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));
|
||||
}
|
||||
|
||||
@@ -74,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)>
|
||||
@@ -105,6 +123,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_VECTOR_MEMBER_FORWARD, _)) {}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
|
||||
: base_type(std::forward<base_type>(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)
|
||||
@@ -132,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;
|
||||
}
|
||||
|
||||
@@ -142,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;
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
|
||||
#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_VECTOR_MEMBER_AT_IMPL, _)
|
||||
|
||||
template<typename I>
|
||||
typename add_reference<typename mpl::at<types, I>::type>::type
|
||||
@@ -166,3 +206,4 @@
|
||||
|
||||
#undef N
|
||||
|
||||
|
||||
@@ -106,6 +106,11 @@ namespace boost { namespace fusion
|
||||
vector(vector const& rhs)
|
||||
: vec(rhs.vec) {}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
vector(vector&& rhs)
|
||||
: vec(std::forward<vector_n>(rhs.vec)) {}
|
||||
#endif
|
||||
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
@@ -135,6 +140,23 @@ namespace boost { namespace fusion
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user