forked from boostorg/fusion
Compare commits
1 Commits
boost-1.52
...
boost-1.51
Author | SHA1 | Date | |
---|---|---|---|
8f9736a5f3 |
@ -20,7 +20,6 @@
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/preprocessor/comma_if.hpp>
|
||||
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
@ -62,20 +61,15 @@
|
||||
BOOST_PP_COMMA_IF(N) \
|
||||
BOOST_FUSION_MAKE_INIT_LIST_ENTRY_I(BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE))
|
||||
|
||||
#define BOOST_FUSION_ITERATOR_NAME(NAME) \
|
||||
BOOST_PP_CAT(boost_fusion_detail_, BOOST_PP_CAT(NAME, _iterator))
|
||||
|
||||
// Note: all template parameter names need to be uglified, otherwise they might
|
||||
// shadow a template parameter of the struct when used with
|
||||
// BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE
|
||||
|
||||
#define BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS(Z, N, NAME) \
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
struct value_of< \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, N> \
|
||||
> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct value_of<NAME##_iterator<boost_fusion_uglified_Sq, N> > \
|
||||
: boost::mpl::identity< \
|
||||
typename boost_fusion_detail_Sq::t##N##_type \
|
||||
typename boost_fusion_uglified_Sq::t##N##_type \
|
||||
> \
|
||||
{ \
|
||||
};
|
||||
@ -83,10 +77,10 @@
|
||||
#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
|
||||
SPEC_TYPE, CALL_ARG_TYPE, TYPE_QUAL, ATTRIBUTE, N) \
|
||||
\
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct deref<SPEC_TYPE, N> > \
|
||||
{ \
|
||||
typedef typename boost_fusion_detail_Sq::t##N##_type TYPE_QUAL& type; \
|
||||
typedef typename boost_fusion_uglified_Sq::t##N##_type TYPE_QUAL& type; \
|
||||
static type call(CALL_ARG_TYPE, N> const& iter) \
|
||||
{ \
|
||||
return iter.seq_.BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE); \
|
||||
@ -95,48 +89,48 @@
|
||||
|
||||
#define BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS(R, NAME, N, ATTRIBUTE) \
|
||||
BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<boost_fusion_uglified_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<boost_fusion_uglified_Sq, \
|
||||
, \
|
||||
ATTRIBUTE, \
|
||||
N) \
|
||||
BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<const boost_fusion_uglified_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<const boost_fusion_uglified_Sq, \
|
||||
const, \
|
||||
ATTRIBUTE, \
|
||||
N) \
|
||||
BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
|
||||
const BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, \
|
||||
const BOOST_PP_CAT(NAME, _iterator)<boost_fusion_uglified_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<boost_fusion_uglified_Sq, \
|
||||
, \
|
||||
ATTRIBUTE, \
|
||||
N) \
|
||||
BOOST_FUSION_MAKE_ITERATOR_DEREF_SPEC( \
|
||||
const BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<const boost_fusion_detail_Sq, \
|
||||
const BOOST_PP_CAT(NAME, _iterator)<const boost_fusion_uglified_Sq, \
|
||||
BOOST_PP_CAT(NAME, _iterator)<const boost_fusion_uglified_Sq, \
|
||||
const, \
|
||||
ATTRIBUTE, \
|
||||
N) \
|
||||
|
||||
#define BOOST_FUSION_MAKE_VALUE_AT_SPECS(Z, N, DATA) \
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
struct value_at<boost_fusion_detail_Sq, boost::mpl::int_<N> > \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct value_at<boost_fusion_uglified_Sq, boost::mpl::int_<N> > \
|
||||
{ \
|
||||
typedef typename boost_fusion_detail_Sq::t##N##_type type; \
|
||||
typedef typename boost_fusion_uglified_Sq::t##N##_type type; \
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_MAKE_AT_SPECS(R, DATA, N, ATTRIBUTE) \
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
struct at<boost_fusion_detail_Sq, boost::mpl::int_<N> > \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct at<boost_fusion_uglified_Sq, boost::mpl::int_<N> > \
|
||||
{ \
|
||||
typedef typename boost::mpl::if_< \
|
||||
boost::is_const<boost_fusion_detail_Sq>, \
|
||||
typename boost_fusion_detail_Sq::t##N##_type const&, \
|
||||
typename boost_fusion_detail_Sq::t##N##_type& \
|
||||
boost::is_const<boost_fusion_uglified_Sq>, \
|
||||
typename boost_fusion_uglified_Sq::t##N##_type const&, \
|
||||
typename boost_fusion_uglified_Sq::t##N##_type& \
|
||||
>::type type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_Sq& sq) \
|
||||
static type call(boost_fusion_uglified_Sq& sq) \
|
||||
{ \
|
||||
return sq. BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE); \
|
||||
} \
|
||||
@ -148,11 +142,7 @@
|
||||
#define BOOST_FUSION_MAKE_DATA_MEMBER(R, DATA, N, ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE);
|
||||
|
||||
// Note: We can't nest the iterator inside the struct because we run into
|
||||
// a MSVC10 bug involving partial specializations of nested templates.
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_IMPL(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
|
||||
struct NAME : boost::fusion::sequence_facade< \
|
||||
NAME, \
|
||||
boost::fusion::random_access_traversal_tag \
|
||||
@ -164,8 +154,6 @@
|
||||
#define BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE_IMPL( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES) \
|
||||
\
|
||||
BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
|
||||
\
|
||||
template < \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL( \
|
||||
(0)TEMPLATE_PARAMS_SEQ) \
|
||||
@ -185,201 +173,176 @@
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
|
||||
// Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
|
||||
// ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
|
||||
// sequence produces warnings on MSVC.
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL(NAME, ATTRIBUTES_SEQ) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
|
||||
NAME, \
|
||||
ATTRIBUTES_SEQ, \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
|
||||
BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ))
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL( \
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(NAME, ATTRIBUTES_SEQ) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
|
||||
NAME, \
|
||||
ATTRIBUTES_SEQ, \
|
||||
BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((0)ATTRIBUTES_SEQ)))
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
|
||||
NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
|
||||
\
|
||||
template <typename boost_fusion_detail_Seq, int N> \
|
||||
struct BOOST_FUSION_ITERATOR_NAME(NAME) \
|
||||
NAME() \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ), \
|
||||
BOOST_FUSION_MAKE_DEFAULT_INIT_LIST, \
|
||||
BOOST_FUSION_IGNORE_1) \
|
||||
(ATTRIBUTES_SEQ) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ), \
|
||||
BOOST_FUSION_MAKE_COPY_CONSTRUCTOR, \
|
||||
BOOST_FUSION_IGNORE_2) \
|
||||
(NAME, ATTRIBUTES_SEQ) \
|
||||
\
|
||||
template <typename boost_fusion_uglified_Seq> \
|
||||
NAME(const boost_fusion_uglified_Seq& rhs) \
|
||||
{ \
|
||||
boost::fusion::copy(rhs, *this); \
|
||||
} \
|
||||
\
|
||||
template <typename boost_fusion_uglified_Seq> \
|
||||
NAME& operator=(const boost_fusion_uglified_Seq& rhs) \
|
||||
{ \
|
||||
boost::fusion::copy(rhs, *this); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
template <typename boost_fusion_uglified_Seq, int N> \
|
||||
struct NAME##_iterator \
|
||||
: boost::fusion::iterator_facade< \
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Seq, N>, \
|
||||
NAME##_iterator<boost_fusion_uglified_Seq, N>, \
|
||||
boost::fusion::random_access_traversal_tag \
|
||||
> \
|
||||
{ \
|
||||
typedef boost::mpl::int_<N> index; \
|
||||
typedef boost_fusion_detail_Seq sequence_type; \
|
||||
typedef boost_fusion_uglified_Seq sequence_type; \
|
||||
\
|
||||
BOOST_FUSION_ITERATOR_NAME(NAME)(boost_fusion_detail_Seq& seq) \
|
||||
: seq_(seq) {} \
|
||||
NAME##_iterator(boost_fusion_uglified_Seq& seq) : seq_(seq) {} \
|
||||
\
|
||||
boost_fusion_detail_Seq& seq_; \
|
||||
boost_fusion_uglified_Seq& seq_; \
|
||||
\
|
||||
template <typename boost_fusion_detail_T> struct value_of; \
|
||||
template <typename boost_fusion_uglified_T> struct value_of; \
|
||||
BOOST_PP_REPEAT( \
|
||||
ATTRIBUTES_SEQ_SIZE, \
|
||||
BOOST_FUSION_MAKE_ITERATOR_VALUE_OF_SPECS, \
|
||||
NAME) \
|
||||
\
|
||||
template <typename boost_fusion_detail_T> struct deref; \
|
||||
template <typename boost_fusion_uglified_T> struct deref; \
|
||||
BOOST_PP_SEQ_FOR_EACH_I( \
|
||||
BOOST_FUSION_MAKE_ITERATOR_DEREF_SPECS, \
|
||||
NAME, \
|
||||
ATTRIBUTES_SEQ) \
|
||||
\
|
||||
template <typename boost_fusion_detail_It> \
|
||||
template <typename boost_fusion_uglified_It> \
|
||||
struct next \
|
||||
{ \
|
||||
typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
|
||||
typename boost_fusion_detail_It::sequence_type, \
|
||||
boost_fusion_detail_It::index::value + 1 \
|
||||
typedef NAME##_iterator< \
|
||||
typename boost_fusion_uglified_It::sequence_type, \
|
||||
boost_fusion_uglified_It::index::value + 1 \
|
||||
> type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_It const& it) \
|
||||
static type call(boost_fusion_uglified_It const& it) \
|
||||
{ \
|
||||
return type(it.seq_); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <typename boost_fusion_detail_It> \
|
||||
template <typename boost_fusion_uglified_It> \
|
||||
struct prior \
|
||||
{ \
|
||||
typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
|
||||
typename boost_fusion_detail_It::sequence_type, \
|
||||
boost_fusion_detail_It::index::value - 1 \
|
||||
typedef NAME##_iterator< \
|
||||
typename boost_fusion_uglified_It::sequence_type, \
|
||||
boost_fusion_uglified_It::index::value - 1 \
|
||||
> type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_It const& it) \
|
||||
static type call(boost_fusion_uglified_It const& it) \
|
||||
{ \
|
||||
return type(it.seq_); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template < \
|
||||
typename boost_fusion_detail_It1, \
|
||||
typename boost_fusion_detail_It2 \
|
||||
typename boost_fusion_uglified_It1, \
|
||||
typename boost_fusion_uglified_It2 \
|
||||
> \
|
||||
struct distance \
|
||||
{ \
|
||||
typedef typename boost::mpl::minus< \
|
||||
typename boost_fusion_detail_It2::index, \
|
||||
typename boost_fusion_detail_It1::index \
|
||||
typename boost_fusion_uglified_It2::index, \
|
||||
typename boost_fusion_uglified_It1::index \
|
||||
>::type type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_It1 const& it1, \
|
||||
boost_fusion_detail_It2 const& it2) \
|
||||
static type call(boost_fusion_uglified_It1 const& it1, \
|
||||
boost_fusion_uglified_It2 const& it2) \
|
||||
{ \
|
||||
return type(); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template < \
|
||||
typename boost_fusion_detail_It, \
|
||||
typename boost_fusion_detail_M \
|
||||
typename boost_fusion_uglified_It, \
|
||||
typename boost_fusion_uglified_M \
|
||||
> \
|
||||
struct advance \
|
||||
{ \
|
||||
typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
|
||||
typename boost_fusion_detail_It::sequence_type, \
|
||||
boost_fusion_detail_It::index::value \
|
||||
+ boost_fusion_detail_M::value \
|
||||
typedef NAME##_iterator< \
|
||||
typename boost_fusion_uglified_It::sequence_type, \
|
||||
boost_fusion_uglified_It::index::value \
|
||||
+ boost_fusion_uglified_M::value \
|
||||
> type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_It const& it) \
|
||||
static type call(boost_fusion_uglified_It const& it) \
|
||||
{ \
|
||||
return type(it.seq_); \
|
||||
} \
|
||||
}; \
|
||||
};
|
||||
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS_IMPL_IMPL( \
|
||||
NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
|
||||
}; \
|
||||
\
|
||||
/* Note: second BOOST_PP_IF is necessary to avoid MSVC warning when */ \
|
||||
/* calling BOOST_FUSION_IGNORE_1 with no arguments. */ \
|
||||
NAME() \
|
||||
BOOST_PP_IF( \
|
||||
ATTRIBUTES_SEQ_SIZE, \
|
||||
BOOST_FUSION_MAKE_DEFAULT_INIT_LIST, \
|
||||
BOOST_FUSION_IGNORE_1) \
|
||||
(BOOST_PP_IF( \
|
||||
ATTRIBUTES_SEQ_SIZE, \
|
||||
ATTRIBUTES_SEQ, \
|
||||
0)) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
BOOST_PP_IF( \
|
||||
ATTRIBUTES_SEQ_SIZE, \
|
||||
BOOST_FUSION_MAKE_COPY_CONSTRUCTOR, \
|
||||
BOOST_FUSION_IGNORE_2) \
|
||||
(NAME, ATTRIBUTES_SEQ) \
|
||||
\
|
||||
template <typename boost_fusion_detail_Seq> \
|
||||
NAME(const boost_fusion_detail_Seq& rhs) \
|
||||
{ \
|
||||
boost::fusion::copy(rhs, *this); \
|
||||
} \
|
||||
\
|
||||
template <typename boost_fusion_detail_Seq> \
|
||||
NAME& operator=(const boost_fusion_detail_Seq& rhs) \
|
||||
{ \
|
||||
boost::fusion::copy(rhs, *this); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct begin \
|
||||
{ \
|
||||
typedef BOOST_FUSION_ITERATOR_NAME(NAME)<boost_fusion_detail_Sq, 0> \
|
||||
type; \
|
||||
typedef NAME##_iterator<boost_fusion_uglified_Sq, 0> type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_Sq& sq) \
|
||||
static type call(boost_fusion_uglified_Sq& sq) \
|
||||
{ \
|
||||
return type(sq); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct end \
|
||||
{ \
|
||||
typedef BOOST_FUSION_ITERATOR_NAME(NAME)< \
|
||||
boost_fusion_detail_Sq, \
|
||||
typedef NAME##_iterator< \
|
||||
boost_fusion_uglified_Sq, \
|
||||
ATTRIBUTES_SEQ_SIZE \
|
||||
> type; \
|
||||
\
|
||||
static type call(boost_fusion_detail_Sq& sq) \
|
||||
static type call(boost_fusion_uglified_Sq& sq) \
|
||||
{ \
|
||||
return type(sq); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct size : boost::mpl::int_<ATTRIBUTES_SEQ_SIZE> \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template <typename boost_fusion_detail_Sq> \
|
||||
template <typename boost_fusion_uglified_Sq> \
|
||||
struct empty : boost::mpl::bool_<ATTRIBUTES_SEQ_SIZE == 0> \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template < \
|
||||
typename boost_fusion_detail_Sq, \
|
||||
typename boost_fusion_detail_N \
|
||||
typename boost_fusion_uglified_Sq, \
|
||||
typename boost_fusion_uglified_N \
|
||||
> \
|
||||
struct value_at : value_at< \
|
||||
boost_fusion_detail_Sq, \
|
||||
boost::mpl::int_<boost_fusion_detail_N::value> \
|
||||
boost_fusion_uglified_Sq, \
|
||||
boost::mpl::int_<boost_fusion_uglified_N::value> \
|
||||
> \
|
||||
{ \
|
||||
}; \
|
||||
@ -390,12 +353,12 @@
|
||||
~) \
|
||||
\
|
||||
template < \
|
||||
typename boost_fusion_detail_Sq, \
|
||||
typename boost_fusion_detail_N \
|
||||
typename boost_fusion_uglified_Sq, \
|
||||
typename boost_fusion_uglified_N \
|
||||
> \
|
||||
struct at : at< \
|
||||
boost_fusion_detail_Sq, \
|
||||
boost::mpl::int_<boost_fusion_detail_N::value> \
|
||||
boost_fusion_uglified_Sq, \
|
||||
boost::mpl::int_<boost_fusion_uglified_N::value> \
|
||||
> \
|
||||
{ \
|
||||
}; \
|
||||
|
@ -116,7 +116,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
template<typename State, typename It0, typename F>
|
||||
static Result
|
||||
call(State const& state,It0 const&, F)
|
||||
call(State const& state,It0 const& it0, F)
|
||||
{
|
||||
return static_cast<Result>(state);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
template<typename State, typename It0, typename F>
|
||||
static Result
|
||||
call(State const& state,It0 const&, F)
|
||||
call(State const& state,It0 const& it0, F)
|
||||
{
|
||||
return static_cast<Result>(state);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace detail
|
||||
struct unrolled_any<0>
|
||||
{
|
||||
template <typename It, typename F>
|
||||
static bool call(It const&, F)
|
||||
static bool call(It const& it, F f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,23 +11,24 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// With variadics, we will use the PP version version
|
||||
// With no decltype and variadics, we will use the C++03 version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
# include <boost/fusion/container/deque/detail/pp_deque.hpp>
|
||||
#if (defined(BOOST_NO_DECLTYPE) \
|
||||
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \
|
||||
|| defined(BOOST_NO_RVALUE_REFERENCES))
|
||||
# include <boost/fusion/container/deque/detail/cpp03_deque.hpp>
|
||||
#else
|
||||
# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
# define BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
# define BOOST_FUSION_HAS_CPP11_DEQUE
|
||||
# endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 variadic interface
|
||||
// C++11 interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
#include <boost/fusion/container/deque/detail/variadic_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/cpp11_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/deque_fwd.hpp>
|
||||
#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/at_impl.hpp>
|
||||
@ -35,10 +36,8 @@
|
||||
#include <boost/fusion/container/deque/detail/end_impl.hpp>
|
||||
#include <boost/fusion/container/deque/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/empty.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
@ -49,22 +48,6 @@ namespace boost { namespace fusion
|
||||
template <typename ...Elements>
|
||||
struct deque : detail::nil_keyed_element
|
||||
{
|
||||
typedef deque_tag fusion_tag;
|
||||
typedef bidirectional_traversal_tag category;
|
||||
typedef mpl::int_<0> size;
|
||||
typedef mpl::int_<0> next_up;
|
||||
typedef mpl::int_<0> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
template <typename Sequence>
|
||||
deque(Sequence const&,
|
||||
typename enable_if<
|
||||
mpl::and_<
|
||||
traits::is_sequence<Sequence>
|
||||
, result_of::empty<Sequence>>>::type* /*dummy*/ = 0)
|
||||
{}
|
||||
|
||||
deque() {}
|
||||
};
|
||||
|
||||
template <typename Head, typename ...Tail>
|
||||
@ -77,7 +60,7 @@ namespace boost { namespace fusion
|
||||
typedef typename detail::deque_keyed_values<Head, Tail...>::type base;
|
||||
typedef mpl::int_<(sizeof ...(Tail) + 1)> size;
|
||||
typedef mpl::int_<size::value> next_up;
|
||||
typedef mpl::int_<((size::value == 0) ? 0 : -1)> next_down;
|
||||
typedef mpl::int_<mpl::int_<((size::value == 0) ? 0 : -1)>::type::value> next_down;
|
||||
typedef mpl::false_ is_view;
|
||||
|
||||
deque()
|
||||
@ -88,45 +71,11 @@ namespace boost { namespace fusion
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
template <typename ...Elements>
|
||||
deque(deque<Elements...>& seq)
|
||||
: base(seq)
|
||||
explicit deque(typename detail::call_param<Head>::type head
|
||||
, typename detail::call_param<Tail>::type... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>::call(head, tail...))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename ...Elements>
|
||||
deque(deque<Elements...>&& seq)
|
||||
: base(std::forward<deque<Elements...>>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
deque(deque const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
deque(deque&& seq)
|
||||
: base(std::forward<deque>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
explicit deque(Head const& head, Tail const&... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>::construct(head, tail...))
|
||||
{}
|
||||
|
||||
template <typename Head_, typename ...Tail_>
|
||||
explicit deque(Head_ const& head, Tail_ const&... tail)
|
||||
: base(detail::deque_keyed_values<Head_, Tail_...>::construct(head, tail...))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename Head_, typename ...Tail_>
|
||||
explicit deque(Head_&& head, Tail_&&... tail)
|
||||
: base(detail::deque_keyed_values<Head, Tail...>
|
||||
::forward_(std::forward<Head_>(head), std::forward<Tail_>(tail)...))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <typename Sequence>
|
||||
explicit deque(Sequence const& seq
|
||||
, typename disable_if<is_convertible<Sequence, Head> >::type* /*dummy*/ = 0)
|
||||
@ -146,16 +95,6 @@ namespace boost { namespace fusion
|
||||
base::operator=(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename T>
|
||||
deque& operator=(T&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<T>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}}
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
#if (defined(BOOST_NO_DECLTYPE) \
|
||||
|| defined(BOOST_NO_VARIADIC_TEMPLATES) \
|
||||
|| defined(BOOST_NO_RVALUE_REFERENCES))
|
||||
# include <boost/fusion/container/deque/detail/pp_deque_fwd.hpp>
|
||||
# include <boost/fusion/container/deque/detail/cpp03_deque_fwd.hpp>
|
||||
#else
|
||||
# if !defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
# define BOOST_FUSION_HAS_VARIADIC_DEQUE
|
||||
# if !defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
# define BOOST_FUSION_HAS_CPP11_DEQUE
|
||||
# endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -5,17 +5,17 @@
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_PP_FUSION_DEQUE_26112006_1649)
|
||||
#define BOOST_PP_FUSION_DEQUE_26112006_1649
|
||||
#if !defined(BOOST_CPP03_FUSION_DEQUE_26112006_1649)
|
||||
#define BOOST_CPP03_FUSION_DEQUE_26112006_1649
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/container/deque/limits.hpp>
|
||||
#include <boost/fusion/container/deque/front_extended_deque.hpp>
|
||||
#include <boost/fusion/container/deque/back_extended_deque.hpp>
|
||||
#include <boost/fusion/container/deque/detail/pp_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/cpp03_deque_keyed_values.hpp>
|
||||
#include <boost/fusion/container/deque/detail/deque_initial_size.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
|
||||
@ -87,34 +87,13 @@ namespace boost { namespace fusion {
|
||||
: base(t0, detail::nil_keyed_element())
|
||||
{}
|
||||
|
||||
explicit deque(deque const& rhs)
|
||||
: base(rhs)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
explicit deque(T0&& t0)
|
||||
: base(std::forward<T0>(t0), detail::nil_keyed_element())
|
||||
{}
|
||||
|
||||
explicit deque(deque&& rhs)
|
||||
: base(std::forward<deque>(rhs))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
|
||||
: base(seq)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& seq)
|
||||
: base(std::forward<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>>(seq))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<typename Sequence>
|
||||
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
|
||||
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0)
|
||||
: base(base::from_iterator(fusion::begin(seq)))
|
||||
{}
|
||||
|
||||
@ -134,16 +113,6 @@ namespace boost { namespace fusion {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
template <typename T>
|
||||
deque&
|
||||
operator=(T&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<T>(rhs));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}}
|
||||
|
@ -5,10 +5,10 @@
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_PP_DEQUE_FORWARD_02092007_0749)
|
||||
#define FUSION_PP_DEQUE_FORWARD_02092007_0749
|
||||
#if !defined(FUSION_CPP03_DEQUE_FORWARD_02092007_0749)
|
||||
#define FUSION_CPP03_DEQUE_FORWARD_02092007_0749
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
@ -72,11 +72,6 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
return type();
|
||||
}
|
||||
|
||||
static type forward_()
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename N, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
|
@ -28,23 +28,13 @@ namespace boost { namespace fusion { namespace detail
|
||||
typedef typename deque_keyed_values_impl<next_index, Tail...>::type tail;
|
||||
typedef keyed_element<N, Head, tail> type;
|
||||
|
||||
static type construct(
|
||||
static type call(
|
||||
typename detail::call_param<Head>::type head
|
||||
, typename detail::call_param<Tail>::type... tail)
|
||||
{
|
||||
return type(
|
||||
head
|
||||
, deque_keyed_values_impl<next_index, Tail...>::construct(tail...)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Head_, typename ...Tail_>
|
||||
static type forward_(Head_&& head, Tail_&&... tail)
|
||||
{
|
||||
return type(
|
||||
std::forward<Head_>(head)
|
||||
, deque_keyed_values_impl<next_index, Tail_...>::
|
||||
forward_(std::forward<Tail_>(tail)...)
|
||||
, deque_keyed_values_impl<next_index, Tail...>::call(tail...)
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -55,8 +45,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
struct deque_keyed_values_impl<N>
|
||||
{
|
||||
typedef nil_keyed_element type;
|
||||
static type construct() { return type(); }
|
||||
static type forward_() { return type(); }
|
||||
static type call() { return type(); }
|
||||
};
|
||||
|
||||
template <typename ...Elements>
|
@ -9,12 +9,10 @@
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#define FUSION_DEQUE_FORWARD_CTOR_FORWARD(z, n, _) std::forward<T##n>(t##n)
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
@ -24,22 +22,14 @@
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_DEQUE_FORWARD_CTOR_FORWARD
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
deque(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::construct(BOOST_PP_ENUM_PARAMS(N, t)))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::call(BOOST_PP_ENUM_PARAMS(N, t)))
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
deque(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
|
||||
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::
|
||||
forward_(BOOST_PP_ENUM(N, FUSION_DEQUE_FORWARD_CTOR_FORWARD, _)))
|
||||
{}
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
|
||||
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
|
@ -9,30 +9,25 @@
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
|
||||
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_shifted.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define FUSION_DEQUE_KEYED_VALUES_FORWARD(z, n, _) \
|
||||
std::forward<BOOST_PP_CAT(T, n)>(BOOST_PP_CAT(t, n))
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/deque/detail/deque_keyed_values_call.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_DEQUE_KEYED_VALUES_FORWARD
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
static type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
static type call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
|
||||
{
|
||||
return type(t0,
|
||||
deque_keyed_values_impl<
|
||||
@ -43,16 +38,5 @@
|
||||
>::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
|
||||
}
|
||||
|
||||
static type forward_(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && t))
|
||||
{
|
||||
return type(std::forward<T0>(t0),
|
||||
deque_keyed_values_impl<
|
||||
next_index
|
||||
#if N > 1
|
||||
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
|
||||
#endif
|
||||
>::forward_(BOOST_PP_ENUM_SHIFTED(N, FUSION_DEQUE_KEYED_VALUES_FORWARD, _)));
|
||||
}
|
||||
|
||||
#undef N
|
||||
#endif
|
||||
|
@ -47,42 +47,16 @@ namespace boost { namespace fusion { namespace detail
|
||||
*it, base::from_iterator(fusion::next(it)));
|
||||
}
|
||||
|
||||
keyed_element(keyed_element const& rhs)
|
||||
: Rest(rhs.get_base()), value_(rhs.value_)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element(keyed_element&& rhs)
|
||||
: Rest(std::forward<Rest>(rhs.forward_base()))
|
||||
, value_(std::forward<Value>(rhs.value_))
|
||||
{}
|
||||
#endif
|
||||
|
||||
template <typename U, typename Rst>
|
||||
keyed_element(keyed_element<Key, U, Rst> const& rhs)
|
||||
: Rest(rhs.get_base()), value_(rhs.value_)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#endif
|
||||
|
||||
Rest& get_base()
|
||||
Rest const get_base() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rest const& get_base() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
Rest&& forward_base()
|
||||
{
|
||||
return std::forward<Rest>(*static_cast<Rest*>(this));
|
||||
}
|
||||
#endif
|
||||
|
||||
typename cref_result<Value>::type get(Key) const
|
||||
{
|
||||
return value_;
|
||||
@ -93,19 +67,10 @@ namespace boost { namespace fusion { namespace detail
|
||||
return value_;
|
||||
}
|
||||
|
||||
keyed_element(
|
||||
typename detail::call_param<Value>::type value
|
||||
, Rest const& rest)
|
||||
keyed_element(typename call_param<Value>::type value, Rest const& rest)
|
||||
: Rest(rest), value_(value)
|
||||
{}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element(Value&& value, Rest&& rest)
|
||||
: Rest(std::forward<Rest>(rest))
|
||||
, value_(std::forward<Value>(value))
|
||||
{}
|
||||
#endif
|
||||
|
||||
keyed_element()
|
||||
: Rest(), value_()
|
||||
{}
|
||||
@ -125,15 +90,6 @@ namespace boost { namespace fusion { namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
keyed_element& operator=(keyed_element&& rhs)
|
||||
{
|
||||
base::operator=(std::forward<keyed_element>(rhs));
|
||||
value_ = std::forward<Value>(rhs.value_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Value value_;
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#if !defined(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
|
||||
#define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
|
||||
|
||||
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||
#if defined(BOOST_FUSION_HAS_CPP11_DEQUE)
|
||||
#error "C++03 only! This file should not have been included"
|
||||
#endif
|
||||
|
||||
|
@ -12,14 +12,11 @@
|
||||
#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)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -37,14 +34,6 @@
|
||||
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,31 +9,24 @@
|
||||
#if !defined(FUSION_MACRO_05042005)
|
||||
#define FUSION_MACRO_05042005
|
||||
|
||||
#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_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_ASSIGN(z, n, _) \
|
||||
#define FUSION_MEMBER_ASSIGN(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
|
||||
|
||||
#define FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN(z, n, _) \
|
||||
#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _) \
|
||||
this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, 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, _) \
|
||||
#define FUSION_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_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
|
||||
#define FUSION_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) \
|
||||
@ -47,32 +40,21 @@
|
||||
struct BOOST_PP_CAT(vector_data, N)
|
||||
{
|
||||
BOOST_PP_CAT(vector_data, N)()
|
||||
: 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_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
N, typename detail::call_param<T, >::type _))
|
||||
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_MEMBER_INIT, _) {}
|
||||
: BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)(
|
||||
BOOST_PP_CAT(vector_data, N) const& other)
|
||||
: 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_ENUM(N, FUSION_COPY_INIT, _) {}
|
||||
|
||||
BOOST_PP_CAT(vector_data, N)&
|
||||
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
|
||||
{
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -82,7 +64,7 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence const>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
|
||||
@ -92,11 +74,11 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_MEMBER_DECL, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
|
||||
};
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
@ -123,19 +105,6 @@
|
||||
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)
|
||||
@ -163,7 +132,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_VECTOR_MEMBER_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -173,21 +142,12 @@
|
||||
{
|
||||
typedef typename result_of::begin<Sequence const>::type I0;
|
||||
I0 i0 = fusion::begin(seq);
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_VECTOR_MEMBER_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_DEREF_MEMBER_ASSIGN, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_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_VECTOR_MEMBER_AT_IMPL, _)
|
||||
BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
|
||||
|
||||
template<typename I>
|
||||
typename add_reference<typename mpl::at<types, I>::type>::type
|
||||
@ -206,4 +166,3 @@
|
||||
|
||||
#undef N
|
||||
|
||||
|
||||
|
@ -106,11 +106,6 @@ 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()) {}
|
||||
@ -140,23 +135,6 @@ 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
|
||||
|
@ -57,13 +57,13 @@ namespace boost { namespace fusion
|
||||
template <typename Function, class Sequence> struct invoke;
|
||||
}
|
||||
|
||||
//~ template <typename Function, class Sequence>
|
||||
//~ inline typename result_of::invoke<Function, Sequence>::type
|
||||
//~ invoke(Function, Sequence &);
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function, Sequence>::type
|
||||
invoke(Function, Sequence &);
|
||||
|
||||
//~ template <typename Function, class Sequence>
|
||||
//~ inline typename result_of::invoke<Function, Sequence const>::type
|
||||
//~ invoke(Function, Sequence const &);
|
||||
template <typename Function, class Sequence>
|
||||
inline typename result_of::invoke<Function, Sequence const>::type
|
||||
invoke(Function, Sequence const &);
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
@ -85,9 +85,6 @@ namespace boost { namespace fusion
|
||||
template <typename T, class Sequence>
|
||||
struct invoke_data_member;
|
||||
|
||||
template <typename Function, class Sequence, int N, bool RandomAccess>
|
||||
struct invoke_fn_ptr;
|
||||
|
||||
template <typename Function, class Sequence, int N, bool RandomAccess>
|
||||
struct invoke_mem_fn;
|
||||
|
||||
@ -98,10 +95,10 @@ namespace boost { namespace fusion
|
||||
template <typename F, class Sequence, int N, bool RandomAccess>
|
||||
struct invoke_nonmember_builtin
|
||||
// use same implementation as for function objects but...
|
||||
: invoke_fn_ptr< // ...work around boost::result_of bugs
|
||||
: invoke_impl< // ...work around boost::result_of bugs
|
||||
typename mpl::eval_if< ft::is_function<F>,
|
||||
boost::add_reference<F>, boost::remove_cv<F> >::type,
|
||||
Sequence, N, RandomAccess >
|
||||
Sequence, N, false, RandomAccess >
|
||||
{ };
|
||||
|
||||
template <typename Function, class Sequence, int N, bool RandomAccess>
|
||||
@ -202,35 +199,6 @@ namespace boost { namespace fusion
|
||||
Function(BOOST_PP_ENUM(N,M,~)) >::type result_type;
|
||||
#undef M
|
||||
|
||||
#if N > 0
|
||||
|
||||
template <typename F>
|
||||
static inline result_type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
#define M(z,j,data) fusion::at_c<j>(s)
|
||||
return f( BOOST_PP_ENUM(N,M,~) );
|
||||
}
|
||||
|
||||
#else
|
||||
template <typename F>
|
||||
static inline result_type
|
||||
call(F & f, Sequence & /*s*/)
|
||||
{
|
||||
return f();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_fn_ptr<Function,Sequence,N,true>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename ft::result_type<Function>::type result_type;
|
||||
|
||||
#if N > 0
|
||||
|
||||
template <typename F>
|
||||
@ -310,39 +278,6 @@ namespace boost { namespace fusion
|
||||
return f();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <typename Function, class Sequence>
|
||||
struct invoke_fn_ptr<Function,Sequence,N,false>
|
||||
{
|
||||
private:
|
||||
typedef invoke_param_types<Sequence,N> seq;
|
||||
public:
|
||||
|
||||
typedef typename ft::result_type<Function>::type result_type;
|
||||
|
||||
#if N > 0
|
||||
|
||||
template <typename F>
|
||||
static inline result_type
|
||||
call(F & f, Sequence & s)
|
||||
{
|
||||
typename seq::I0 i0 = fusion::begin(s);
|
||||
BOOST_PP_REPEAT_FROM_TO(1,N,M,~)
|
||||
return f( BOOST_PP_ENUM_PARAMS(N,*i) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <typename F>
|
||||
static inline result_type
|
||||
call(F & f, Sequence & /*s*/)
|
||||
{
|
||||
return f();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
@ -23,8 +23,8 @@ namespace boost { namespace fusion
|
||||
iterator_base_type;
|
||||
iterator_base_type iterator_base;
|
||||
|
||||
iterator_adapter(iterator_base_type const& iterator_base_)
|
||||
: iterator_base(iterator_base_) {}
|
||||
iterator_adapter(iterator_base_type const& iterator_base)
|
||||
: iterator_base(iterator_base) {}
|
||||
|
||||
// default implementation
|
||||
template <typename I1, typename I2>
|
||||
|
@ -68,7 +68,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template <typename Key, typename Sequence>
|
||||
inline typename result_of::has_key<Sequence, Key>::type
|
||||
has_key(Sequence const&)
|
||||
has_key(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::has_key<Sequence, Key>::type result;
|
||||
return result();
|
||||
|
@ -8,10 +8,6 @@
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
project
|
||||
: requirements
|
||||
;
|
||||
|
||||
{
|
||||
test-suite fusion :
|
||||
|
||||
@ -80,7 +76,6 @@ project
|
||||
[ run sequence/deque_iterator.cpp : : : : ]
|
||||
[ run sequence/deque_make.cpp : : : : ]
|
||||
[ run sequence/deque_misc.cpp : : : : ]
|
||||
[ run sequence/deque_move.cpp : : : : ]
|
||||
[ run sequence/deque_mutate.cpp : : : : ]
|
||||
[ run sequence/deque_tie.cpp : : : : ]
|
||||
[ run sequence/deque_value_at.cpp : : : : ]
|
||||
@ -114,7 +109,6 @@ project
|
||||
[ run sequence/vector_iterator.cpp : : : : ]
|
||||
[ run sequence/vector_make.cpp : : : : ]
|
||||
[ run sequence/vector_misc.cpp : : : : ]
|
||||
[ run sequence/vector_move.cpp : : : : ]
|
||||
[ run sequence/vector_mutate.cpp : : : : ]
|
||||
[ run sequence/vector_n.cpp : : : : ]
|
||||
[ run sequence/vector_tie.cpp : : : : ]
|
||||
|
@ -57,7 +57,7 @@ test()
|
||||
|
||||
FUSION_SEQUENCE<> empty0;
|
||||
|
||||
#ifndef NO_CONSTRUCT_FROM_NIL
|
||||
#ifndef TR1_TUPLE_TEST
|
||||
FUSION_SEQUENCE<> empty1(empty);
|
||||
#endif
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2012 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES // $$$ JDG temp $$$
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::deque
|
||||
#include "move.hpp"
|
||||
|
||||
#else
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
test();
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,120 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2012 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#error "Valid only on compilers that support rvalues"
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace test_detail
|
||||
{
|
||||
int copies = 0;
|
||||
|
||||
void incr_copy()
|
||||
{
|
||||
copies++;
|
||||
}
|
||||
|
||||
struct x
|
||||
{
|
||||
int i;
|
||||
x() : i(123) {}
|
||||
|
||||
x(x&& rhs) : i(rhs.i) {}
|
||||
|
||||
x& operator=(x&& rhs)
|
||||
{
|
||||
i = rhs.i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
x(x const& rhs)
|
||||
{
|
||||
incr_copy();
|
||||
}
|
||||
|
||||
x& operator=(x const& rhs)
|
||||
{
|
||||
incr_copy();
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<x> vector_type;
|
||||
extern bool disable_rvo; // to disable RVO
|
||||
|
||||
vector_type
|
||||
generate_vec()
|
||||
{
|
||||
vector_type v;
|
||||
v.push_back(x());
|
||||
if (disable_rvo)
|
||||
return v;
|
||||
return vector_type();
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
T move_me(T && val)
|
||||
{
|
||||
T r(std::move(val));
|
||||
if (disable_rvo)
|
||||
return r;
|
||||
return T();
|
||||
}
|
||||
|
||||
typedef FUSION_SEQUENCE<std::vector<x>> return_type;
|
||||
|
||||
return_type
|
||||
generate()
|
||||
{
|
||||
return_type r(generate_vec());
|
||||
if (disable_rvo)
|
||||
return r;
|
||||
return return_type();
|
||||
}
|
||||
|
||||
typedef FUSION_SEQUENCE<std::vector<x>, x> return_type2;
|
||||
|
||||
return_type2
|
||||
generate2()
|
||||
{
|
||||
return_type2 r(generate_vec(), x());
|
||||
if (disable_rvo)
|
||||
return r;
|
||||
return return_type2();
|
||||
}
|
||||
}
|
||||
|
||||
void test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace test_detail;
|
||||
|
||||
return_type v = move_me(generate());
|
||||
BOOST_TEST(copies == 0);
|
||||
|
||||
return_type2 v2 = move_me(generate2());
|
||||
BOOST_TEST(copies == 0);
|
||||
|
||||
v2 = move_me(generate2());
|
||||
BOOST_TEST(copies == 0);
|
||||
|
||||
std::cout << "Copies: " << copies << std::endl;
|
||||
}
|
||||
|
||||
namespace test_detail
|
||||
{
|
||||
bool disable_rvo = true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <boost/fusion/tuple/tuple.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
|
||||
#define NO_CONSTRUCT_FROM_NIL
|
||||
#define TR1_TUPLE_TEST
|
||||
#define FUSION_SEQUENCE tuple
|
||||
#define FUSION_AT get
|
||||
#include "construction.hpp"
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2012 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES // $$$ JDG temp $$$
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::vector
|
||||
#include "move.hpp"
|
||||
|
||||
#else
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
test();
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Reference in New Issue
Block a user