mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-30 12:37:29 +02:00
Merge pull request #140 from Flast/bugfix/define_struct
Workarounds for older compilers.
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <boost/fusion/support/config.hpp>
|
#include <boost/fusion/support/config.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
#include <boost/fusion/iterator/deref.hpp>
|
#include <boost/fusion/iterator/deref.hpp>
|
||||||
#include <boost/fusion/iterator/next.hpp>
|
#include <boost/fusion/iterator/next.hpp>
|
||||||
@ -61,8 +62,26 @@
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
// Use templated version instead.
|
// Use templated version instead.
|
||||||
|
#define BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_FILLER_I( \
|
||||||
|
R, ATTRIBUTE_TUPLE_SIZE, I_, ATTRIBUTE) \
|
||||||
|
\
|
||||||
|
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)= \
|
||||||
|
other.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE);
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_OP( \
|
#define BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_OP( \
|
||||||
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE)
|
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
||||||
|
\
|
||||||
|
BOOST_FUSION_GPU_ENABLED \
|
||||||
|
self_type& operator=(self_type const& other) \
|
||||||
|
{ \
|
||||||
|
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
||||||
|
1, \
|
||||||
|
BOOST_FUSION_DEFINE_STRUCT_COPY_ASSIGN_FILLER_I, \
|
||||||
|
ATTRIBUTE_TUPLE_SIZE, \
|
||||||
|
ATTRIBUTES_SEQ) \
|
||||||
|
\
|
||||||
|
return *this; \
|
||||||
|
}
|
||||||
|
|
||||||
#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||||
|
|
||||||
@ -124,7 +143,9 @@
|
|||||||
|
|
||||||
#else // BOOST_NO_CXX11_RVALUE_REFERENCES
|
#else // BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||||
|
|
||||||
#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \
|
||||||
|
|| BOOST_WORKAROUND(BOOST_GCC, < 40500) \
|
||||||
|
|| BOOST_WORKAROUND(BOOST_MSVC, == 1800)
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR_FILLER_I( \
|
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR_FILLER_I( \
|
||||||
R, ATTRIBUTE_TUPLE_SIZE, I, ATTRIBUTE) \
|
R, ATTRIBUTE_TUPLE_SIZE, I, ATTRIBUTE) \
|
||||||
@ -145,37 +166,34 @@
|
|||||||
ATTRIBUTES_SEQ) \
|
ATTRIBUTES_SEQ) \
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||||
|
|
||||||
|
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR( \
|
||||||
|
NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
||||||
|
\
|
||||||
|
BOOST_FUSION_GPU_ENABLED NAME(self_type&&) = default;
|
||||||
|
|
||||||
|
#endif // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \
|
||||||
|
|| BOOST_WORKAROUND(BOOST_GCC, < 40600) \
|
||||||
|
|| BOOST_WORKAROUND(BOOST_MSVC, == 1800)
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_FILLER_I( \
|
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_FILLER_I( \
|
||||||
R, ATTRIBUTE_TUPLE_SIZE, I_, ATTRIBUTE) \
|
R, ATTRIBUTE_TUPLE_SIZE, I_, ATTRIBUTE) \
|
||||||
\
|
\
|
||||||
BOOST_PP_EXPR_IF( \
|
|
||||||
I_, \
|
|
||||||
typedef typename \
|
|
||||||
boost::fusion::result_of::next< \
|
|
||||||
BOOST_PP_CAT(I,BOOST_PP_DEC(I_)) \
|
|
||||||
>::type \
|
|
||||||
BOOST_PP_CAT(I,I_); \
|
|
||||||
BOOST_PP_CAT(I,I_) BOOST_PP_CAT(i,I_)= \
|
|
||||||
boost::fusion::next(BOOST_PP_CAT(i,BOOST_PP_DEC(I_))); \
|
|
||||||
) \
|
|
||||||
\
|
|
||||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)=std::move( \
|
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE)=std::move( \
|
||||||
boost::fusion::deref(BOOST_PP_CAT(i,I_)));
|
other.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPLE_SIZE,1,ATTRIBUTE));
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \
|
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \
|
||||||
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
||||||
\
|
\
|
||||||
BOOST_FUSION_GPU_ENABLED \
|
BOOST_FUSION_GPU_ENABLED \
|
||||||
self_type& operator=(self_type&& seq) \
|
self_type& operator=(self_type&& other) \
|
||||||
{ \
|
{ \
|
||||||
typedef \
|
|
||||||
boost::fusion::result_of::begin<Seq>::type \
|
|
||||||
I0; \
|
|
||||||
I0 i0=boost::fusion::begin(seq); \
|
|
||||||
\
|
|
||||||
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
BOOST_PP_SEQ_FOR_EACH_I_R( \
|
||||||
1, \
|
1, \
|
||||||
BOOST_FUSION_DEFINE_STRUCT_ASSIGN_FILLER_I, \
|
BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_FILLER_I, \
|
||||||
ATTRIBUTE_TUPLE_SIZE, \
|
ATTRIBUTE_TUPLE_SIZE, \
|
||||||
ATTRIBUTES_SEQ) \
|
ATTRIBUTES_SEQ) \
|
||||||
\
|
\
|
||||||
@ -184,11 +202,6 @@
|
|||||||
|
|
||||||
#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
#else // BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_CTOR( \
|
|
||||||
NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
|
||||||
\
|
|
||||||
BOOST_FUSION_GPU_ENABLED NAME(self_type&&) = default;
|
|
||||||
|
|
||||||
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \
|
#define BOOST_FUSION_DEFINE_STRUCT_MOVE_ASSIGN_OP( \
|
||||||
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
ATTRIBUTES_SEQ, ATTRIBUTE_TUPLE_SIZE) \
|
||||||
\
|
\
|
||||||
|
@ -20,7 +20,11 @@ namespace boost { namespace fusion { namespace detail {
|
|||||||
|
|
||||||
template<typename ...T>
|
template<typename ...T>
|
||||||
struct and_impl<integral_constant<T, true>...> : true_type {};
|
struct and_impl<integral_constant<T, true>...> : true_type {};
|
||||||
|
|
||||||
|
// This specialization is necessary to avoid MSVC-12 variadics bug.
|
||||||
|
template<bool ...Cond>
|
||||||
|
struct and_impl1 : and_impl<integral_constant<bool, Cond>...> {};
|
||||||
|
|
||||||
/* fusion::detail::and_ differs from mpl::and_ in the following ways:
|
/* fusion::detail::and_ differs from mpl::and_ in the following ways:
|
||||||
- The empty set is valid and returns true
|
- The empty set is valid and returns true
|
||||||
- A single element set is valid and returns the identity
|
- A single element set is valid and returns the identity
|
||||||
@ -29,7 +33,7 @@ namespace boost { namespace fusion { namespace detail {
|
|||||||
reduces instantations when returning true; the implementation is not
|
reduces instantations when returning true; the implementation is not
|
||||||
recursive. */
|
recursive. */
|
||||||
template<typename ...Cond>
|
template<typename ...Cond>
|
||||||
struct and_ : and_impl<integral_constant<bool, Cond::value>...> {};
|
struct and_ : and_impl1<Cond::value...> {};
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
#endif // FUSION_AND_07152016_1625
|
#endif // FUSION_AND_07152016_1625
|
||||||
|
Reference in New Issue
Block a user