Merge pull request #111 from boostorg/develop

1.60.0 beta
This commit is contained in:
Joel de Guzman
2015-10-28 07:42:24 +08:00
91 changed files with 1959 additions and 2009 deletions

View File

@ -258,6 +258,22 @@ the first call) and [arg_desc] of `seq`.
typename result_of_name_macro<Sequence const, State const, F>::type name_macro( typename result_of_name_macro<Sequence const, State const, F>::type name_macro(
Sequence const& seq, State const& initial_state, F f); Sequence const& seq, State const& initial_state, F f);
template<
typename Sequence,
typename State,
typename F
>
typename result_of_name_macro<Sequence, State, F>::type name_macro(
Sequence& seq, State& initial_state, F f);
template<
typename Sequence,
typename State,
typename F
>
typename result_of_name_macro<Sequence const, State, F>::type name_macro(
Sequence const& seq, State& initial_state, F f);
[def seq_concept_macro [seq_concept]] [def seq_concept_macro [seq_concept]]
[def arg_type_id_macro [arg_type_id]] [def arg_type_id_macro [arg_type_id]]
[def arg_id_macro [arg_id]] [def arg_id_macro [arg_id]]
@ -1722,7 +1738,7 @@ Takes 2 sequences and returns a sequence containing the elements of the first fo
template< template<
typename LhSequence, typename LhSequence,
typename RhSequence> typename RhSequence>
typename __result_of_join__<LhSequence, RhSequence>::type join(LhSequence const& lhs, RhSequence const& rhs); typename __result_of_join__<LhSequence const, RhSequence const>::type join(LhSequence const& lhs, RhSequence const& rhs);
[table Parameters [table Parameters
[[Parameter][Requirement][Description]] [[Parameter][Requirement][Description]]
@ -1767,7 +1783,7 @@ Zips sequences together to form a single sequence, whose members are tuples of t
... ...
typename SequenceN typename SequenceN
> >
typename __result_of_zip__<Sequence1, Sequence2, ... SequenceN>::type typename __result_of_zip__<Sequence1 const, Sequence2 const, ... SequenceN const>::type
zip(Sequence1 const& seq1, Sequence2 const& seq2, ... SequenceN const& seqN); zip(Sequence1 const& seq1, Sequence2 const& seq2, ... SequenceN const& seqN);
[table Parameters [table Parameters
@ -1886,7 +1902,7 @@ Returns a new sequence with an element added at the end.
typename Sequence, typename Sequence,
typename T typename T
> >
typename __result_of_push_back__<Sequence, T>::type push_back( typename __result_of_push_back__<Sequence const, T>::type push_back(
Sequence const& seq, T const& t); Sequence const& seq, T const& t);
[table Parameters [table Parameters
@ -1927,7 +1943,7 @@ Returns a new sequence with an element added at the beginning.
typename Sequence, typename Sequence,
typename T typename T
> >
typename __result_of_push_front__<Sequence, T>::type push_front( typename __result_of_push_front__<Sequence const, T>::type push_front(
Sequence const& seq, T const& t); Sequence const& seq, T const& t);
[table Parameters [table Parameters

View File

@ -66,6 +66,11 @@ cases the most efficient.
template <typename T0, typename T1, typename T2..., typename TN> template <typename T0, typename T1, typename T2..., typename TN>
struct vectorN; struct vectorN;
[important Numbered forms will be deprecated in C++11 and it will be provided
via aliasing templates. It means that your partial specialization
might be compile error. You can detect whether it is aliasing
templates or not, using `BOOST_FUSION_HAS_VARIADIC_VECTOR`.]
[*Variadic form] [*Variadic form]
template < template <
@ -81,9 +86,11 @@ The numbered form accepts the exact number of elements. Example:
vector3<int, char, double> vector3<int, char, double>
The variadic form accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, where For C++11 compilers, the variadic function interface has no upper bound.
`FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that
defaults to `10`. Example: For C++03 compilers, the The variadic form accepts `0` to
`FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
user definable predefined maximum that defaults to `10`. Example:
vector<int, char, double> vector<int, char, double>
@ -232,9 +239,11 @@ each element is peculiarly constant (see __recursive_inline__).
> >
struct list; struct list;
The variadic class interface accepts `0` to `FUSION_MAX_LIST_SIZE` For C++11 compilers, the variadic function interface has no upper bound.
elements, where `FUSION_MAX_LIST_SIZE` is a user definable predefined
maximum that defaults to `10`. Example: For C++03 compilers, the variadic class interface accepts `0` to
`FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
definable predefined maximum that defaults to `10`. Example:
list<int, char, double> list<int, char, double>
@ -532,9 +541,11 @@ complexity (see __overloaded_functions__).
> >
struct set; struct set;
The variadic class interface accepts `0` to `FUSION_MAX_SET_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that
defaults to `10`. Example: For C++03 compilers, the variadic class interface accepts `0` to
`FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
definable predefined maximum that defaults to `10`. Example:
set<int, char, double> set<int, char, double>
@ -614,9 +625,11 @@ __overloaded_functions__).
> >
struct map; struct map;
The variadic class interface accepts `0` to `FUSION_MAX_MAP_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
defaults to `10`. Example: For C++03 compilers, the variadic class interface accepts `0` to
`FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
definable predefined maximum that defaults to `10`. Example:
map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> > map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> >
@ -697,10 +710,13 @@ Create a __list__ from one or more values.
typename __result_of_make_list__<T0, T1,... TN>::type typename __result_of_make_list__<T0, T1,... TN>::type
make_list(T0 const& x0, T1 const& x1... TN const& xN); make_list(T0 const& x0, T1 const& x1... TN const& xN);
The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where For C++11 compilers, the variadic function interface has no upper bound.
`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults
to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` For C++03 compilers, the variadic function accepts `0` to
before including any Fusion header to change the default. Example: `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_LIST_SIZE 20 #define FUSION_MAX_LIST_SIZE 20
@ -794,11 +810,13 @@ Create a __vector__ from one or more values.
typename __result_of_make_vector__<T0, T1,... TN>::type typename __result_of_make_vector__<T0, T1,... TN>::type
make_vector(T0 const& x0, T1 const& x1... TN const& xN); make_vector(T0 const& x0, T1 const& x1... TN const& xN);
The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
default. Example: user definable predefined maximum that defaults to `10`. You may define
the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
Fusion header to change the default. Example:
#define FUSION_MAX_VECTOR_SIZE 20 #define FUSION_MAX_VECTOR_SIZE 20
@ -896,11 +914,13 @@ Create a __set__ from one or more values.
typename __result_of_make_set__<T0, T1,... TN>::type typename __result_of_make_set__<T0, T1,... TN>::type
make_set(T0 const& x0, T1 const& x1... TN const& xN); make_set(T0 const& x0, T1 const& x1... TN const& xN);
The variadic function accepts `0` to `FUSION_MAX_SET_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_SET_SIZE` before including any Fusion header to change the `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
default. Example: definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_SET_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_SET_SIZE 20 #define FUSION_MAX_SET_SIZE 20
@ -1049,10 +1069,13 @@ Constructs a tie using a __list__ sequence.
__list__<T0&, T1&,... TN&> __list__<T0&, T1&,... TN&>
list_tie(T0& x0, T1& x1... TN& xN); list_tie(T0& x0, T1& x1... TN& xN);
The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where For C++11 compilers, the variadic function interface has no upper bound.
`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults
to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` For C++03 compilers, the variadic function accepts `0` to
before including any Fusion header to change the default. Example: `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_LIST_SIZE 20 #define FUSION_MAX_LIST_SIZE 20
@ -1096,11 +1119,13 @@ Constructs a tie using a __vector__ sequence.
__vector__<T0&, T1&,... TN&> __vector__<T0&, T1&,... TN&>
vector_tie(T0& x0, T1& x1... TN& xN); vector_tie(T0& x0, T1& x1... TN& xN);
The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
default. Example: user definable predefined maximum that defaults to `10`. You may define
the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
Fusion header to change the default. Example:
#define FUSION_MAX_VECTOR_SIZE 20 #define FUSION_MAX_VECTOR_SIZE 20
@ -1144,11 +1169,14 @@ Constructs a tie using a __map__ sequence.
__map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> > __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
map_tie(D0& d0, D1& d1... DN& dN); map_tie(D0& d0, D1& d1... DN& dN);
The variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
defaults to `10`, and a corresponding number of key types. For C++03 compilers, the variadic function accepts `0` to
You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
including any Fusion header to change the default. Example: definable predefined maximum that defaults to `10`, and a corresponding
number of key types. You may define the preprocessor constant
`FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
default. Example:
#define FUSION_MAX_MAP_SIZE 20 #define FUSION_MAX_MAP_SIZE 20
@ -1249,10 +1277,13 @@ Returns the result type of __make_list__.
template <typename T0, typename T1,... typename TN> template <typename T0, typename T1,... typename TN>
struct make_list; struct make_list;
The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where For C++11 compilers, the variadic function interface has no upper bound.
`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults
to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` For C++03 compilers, the variadic function accepts `0` to
before including any Fusion header to change the default. Example: `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_LIST_SIZE 20 #define FUSION_MAX_LIST_SIZE 20
@ -1333,11 +1364,13 @@ Returns the result type of __make_vector__.
template <typename T0, typename T1,... typename TN> template <typename T0, typename T1,... typename TN>
struct make_vector; struct make_vector;
The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
default. Example: definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_VECTOR_SIZE 20 #define FUSION_MAX_VECTOR_SIZE 20
@ -1427,11 +1460,13 @@ Returns the result type of __make_set__.
template <typename T0, typename T1,... typename TN> template <typename T0, typename T1,... typename TN>
struct make_set; struct make_set;
The variadic function accepts `0` to `FUSION_MAX_SET_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_SET_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_SET_SIZE` before including any Fusion header to change the `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user definable
default. Example: predefined maximum that defaults to `10`. You may define the preprocessor
constant `FUSION_MAX_SET_SIZE` before including any Fusion header to change
the default. Example:
#define FUSION_MAX_SET_SIZE 20 #define FUSION_MAX_SET_SIZE 20
@ -1559,10 +1594,13 @@ Returns the result type of __list_tie__.
template <typename T0, typename T1,... typename TN> template <typename T0, typename T1,... typename TN>
struct list_tie; struct list_tie;
The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where For C++11 compilers, the variadic function interface has no upper bound.
`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaults
to `10`. You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` For C++03 compilers, the variadic function accepts `0` to
before including any Fusion header to change the default. Example: `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_LIST_SIZE 20 #define FUSION_MAX_LIST_SIZE 20
@ -1603,11 +1641,13 @@ Returns the result type of __vector_tie__.
template <typename T0, typename T1,... typename TN> template <typename T0, typename T1,... typename TN>
struct vector_tie; struct vector_tie;
The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change the `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
default. Example: definable predefined maximum that defaults to `10`. You may define the
preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
header to change the default. Example:
#define FUSION_MAX_VECTOR_SIZE 20 #define FUSION_MAX_VECTOR_SIZE 20
@ -1695,11 +1735,13 @@ Returns the result type of __map_tie__.
template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN> template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
struct map_tie; struct map_tie;
The variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements, For C++11 compilers, the variadic function interface has no upper bound.
where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
defaults to `10`. You may define the preprocessor constant For C++03 compilers, the variadic function accepts `0` to
`FUSION_MAX_MAP_SIZE` before including any Fusion header to change the `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user definable
default. Example: predefined maximum that defaults to `10`. You may define the preprocessor
constant `FUSION_MAX_MAP_SIZE` before including any Fusion header to change
the default. Example:
#define FUSION_MAX_MAP_SIZE 20 #define FUSION_MAX_MAP_SIZE 20

View File

@ -1,5 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -10,8 +11,6 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/iteration/accumulate_fwd.hpp> #include <boost/fusion/algorithm/iteration/accumulate_fwd.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp> #include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -27,11 +26,7 @@ namespace boost { namespace fusion
template <typename Sequence, typename State, typename F> template <typename Sequence, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename inline typename result_of::accumulate<Sequence, State const, F>::type
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence, State const, F>
>::type
accumulate(Sequence& seq, State const& state, F f) accumulate(Sequence& seq, State const& state, F f)
{ {
return fusion::fold(seq, state, f); return fusion::fold(seq, state, f);
@ -39,11 +34,7 @@ namespace boost { namespace fusion
template <typename Sequence, typename State, typename F> template <typename Sequence, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename inline typename result_of::accumulate<Sequence const, State const, F>::type
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence const, State const, F>
>::type
accumulate(Sequence const& seq, State const& state, F f) accumulate(Sequence const& seq, State const& state, F f)
{ {
return fusion::fold(seq, state, f); return fusion::fold(seq, state, f);

View File

@ -1,5 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2011 Eric Niebler Copyright (c) 2011 Eric Niebler
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -8,8 +9,6 @@
#define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED #define BOOST_FUSION_ACCUMULATE_FWD_HPP_INCLUDED
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -21,20 +20,12 @@ namespace boost { namespace fusion
template <typename Sequence, typename State, typename F> template <typename Sequence, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename inline typename result_of::accumulate<Sequence, State const, F>::type
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence, State const, F>
>::type
accumulate(Sequence& seq, State const& state, F f); accumulate(Sequence& seq, State const& state, F f);
template <typename Sequence, typename State, typename F> template <typename Sequence, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename inline typename result_of::accumulate<Sequence const, State const, F>::type
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::accumulate<Sequence const, State const, F>
>::type
accumulate(Sequence const& seq, State const& state, F f); accumulate(Sequence const& seq, State const& state, F f);
}} }}

View File

@ -2,6 +2,7 @@
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2006 Dan Marsden Copyright (c) 2006 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt Copyright (c) 2009-2010 Christopher Schmidt
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -45,374 +46,124 @@ namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<typename State, typename It, typename F> template<int SeqSize, typename It, typename State, typename F, typename = void>
struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state) struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)
: fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It))
>
{}; {};
template<typename Result,int N> template<typename It, typename State, typename F>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type>
{ {
template<typename State3, typename It3, typename F> typedef typename State::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_3(State3 const& state3,It3 const& it3,F& f)
{
return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
Result
, N-4
>::call(
f(state3,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it3)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it3),
f);
}
template<typename State2, typename It2, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_2(State2 const& state2,It2 const& it2,F& f)
{
return call_3(
f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2),
f);
}
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
f);
}
}; };
template<typename Result> template<int SeqSize, typename It, typename State, typename F>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,3> struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<SeqSize,It,State,F
{ // MSVC9 issues a compile error as a partial specialization is ambiguous.
template<typename State2, typename It2, typename F> , typename boost::enable_if_has_type<
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename boost::disable_if_c<SeqSize == 0, State>::type::type
static Result >::type>
call_2(State2 const& state2,It2 const& it2,F& f) : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
{ SeqSize-1
return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
} , boost::result_of<
F(
template<typename State1, typename It1, typename F> typename add_reference<typename State::type>::type,
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
f);
}
};
template<typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,2>
{
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1));
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)),
fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0),
f);
}
};
template<typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,1>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return f(state,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0));
}
};
template<typename Result>
struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,0>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
return static_cast<Result>(state);
}
};
template<typename StateRef, typename It0, typename F, int N>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)
{
typedef typename
BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
It0 const
>::type
it1;
typedef typename
BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
rest1
, it1
, F
>::type
rest2;
typedef typename
result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<it1>::type
it2;
typedef typename
BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
rest2
, it2
, F
>::type
rest3;
typedef typename
result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<it2>::type
it3;
typedef typename
BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
typename BOOST_PP_CAT(
BOOST_FUSION_FOLD_NAME, _lvalue_state)<
rest3
, it3
, F
>::type
, typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
it3
>::type
, F
, N-4
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
StateRef
, It0
, F
, 3
>
{
typedef typename
BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
It0 const
>::type
it1;
typedef typename
BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
typename BOOST_PP_CAT(
BOOST_FUSION_FOLD_NAME, _lvalue_state)<
rest1
, it1
, F
>::type
, typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
it1 const
>::type const
, F
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
StateRef
, It0
, F
, 2
>
: BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
StateRef
, It0 const
, F
>::type
, typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
It0 const
>::type const
, F
>
{};
template<typename StateRef, typename It0, typename F>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
StateRef
, It0
, F
, 1
>
: BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<
StateRef
, It0 const
, F
>
{};
template<typename StateRef, typename It0, typename F>
struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
StateRef
, It0
, F
, 0
>
{
typedef StateRef type;
};
template<typename StateRef, typename It0, typename F, int SeqSize>
struct BOOST_PP_CAT(result_of_first_unrolled,BOOST_FUSION_FOLD_NAME)
{
typedef typename
BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)<
typename fusion::detail::result_of_with_decltype<
F(
StateRef,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(
It0 const)
)
>::type
, typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<
It0 const
>::type
, F
, SeqSize-1
>::type
type;
};
template<int SeqSize, typename StateRef, typename Seq, typename F>
struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)
{
typedef typename
BOOST_PP_CAT(
result_of_first_unrolled,BOOST_FUSION_FOLD_NAME)<
StateRef
, BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
) )
, F >
, SeqSize
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
typedef
BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<
type
, SeqSize
>
unrolled_impl;
return unrolled_impl::call(
state,
BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(
fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq)),
f);
}
};
template<typename StateRef, typename Seq, typename F>
struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)<0,StateRef,Seq,F>
{
typedef StateRef type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
return static_cast<StateRef>(state);
}
};
template<typename Seq, typename State, typename F, bool IsSegmented>
struct BOOST_PP_CAT(result_of_, BOOST_FUSION_FOLD_NAME)
: BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME,_impl)<
result_of::size<Seq>::value
, typename add_reference<
typename add_const<State>::type
>::type
, Seq
, F , F
> >
{}; {};
template<typename It, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
0
, It
, State
, F
>::type
BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)(mpl::int_<0>, It const&, typename State::type state, F&)
{
return state;
}
template<typename It, typename State, typename F, int SeqSize>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename lazy_enable_if_c<
SeqSize != 0
, BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
SeqSize
, It
, State
, F
>
>::type
BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
{
return BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)<
typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
, boost::result_of<
F(
typename add_reference<typename State::type>::type,
BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
)
>
, F
>(
mpl::int_<SeqSize-1>()
, fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it)
, f(state, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it))
, f
);
}
template<typename Seq, typename State, typename F
, bool = traits::is_sequence<Seq>::value
, bool = traits::is_segmented<Seq>::value>
struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)
{};
template<typename Seq, typename State, typename F>
struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F, true, false>
: BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
result_of::size<Seq>::value
, BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
)
, add_reference<State>
, F
>
{};
template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F>::type
BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F& f)
{
return BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)<
BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
)
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
, BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(
fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq)
)
, state
, f
);
}
} }
namespace result_of namespace result_of
{ {
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
struct BOOST_FUSION_FOLD_NAME struct BOOST_FUSION_FOLD_NAME
: detail::BOOST_PP_CAT(result_of_, BOOST_FUSION_FOLD_NAME)< : detail::BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F>
Seq
, State
, F
, traits::is_segmented<Seq>::type::value
>
{}; {};
} }
@ -425,10 +176,7 @@ namespace boost { namespace fusion
>::type >::type
BOOST_FUSION_FOLD_NAME(Seq& seq, State const& state, F f) BOOST_FUSION_FOLD_NAME(Seq& seq, State const& state, F f)
{ {
return result_of::BOOST_FUSION_FOLD_NAME<Seq,State const,F>::call( return detail::BOOST_FUSION_FOLD_NAME<Seq, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
@ -440,40 +188,31 @@ namespace boost { namespace fusion
>::type >::type
BOOST_FUSION_FOLD_NAME(Seq const& seq, State const& state, F f) BOOST_FUSION_FOLD_NAME(Seq const& seq, State const& state, F f)
{ {
return result_of::BOOST_FUSION_FOLD_NAME<Seq const,State const,F>::call( return detail::BOOST_FUSION_FOLD_NAME<Seq const, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME< inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq Seq
, State const , State
, F , F
>::type >::type
BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f)
{ {
return result_of::BOOST_FUSION_FOLD_NAME<Seq,State,F>::call( return detail::BOOST_FUSION_FOLD_NAME<Seq, State, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::BOOST_FUSION_FOLD_NAME< inline typename result_of::BOOST_FUSION_FOLD_NAME<
Seq const Seq const
, State const , State
, F , F
>::type >::type
BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f) BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f)
{ {
return result_of::BOOST_FUSION_FOLD_NAME<Seq const,State,F>::call( return detail::BOOST_FUSION_FOLD_NAME<Seq const, State, F>(seq, state, f);
state,
seq,
f);
} }
}} }}

View File

@ -12,341 +12,110 @@ namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<typename State, typename It, typename F> template<int SeqSize, typename It, typename State, typename F, typename = void>
struct fold_lvalue_state struct result_of_it_fold
: fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
typename fusion::result_of::deref<It>::type)
>
{}; {};
template<typename Result,int N> template<typename It, typename State, typename F>
struct unrolled_fold struct result_of_it_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type>
{ {
template<typename State3, typename It3, typename F> typedef typename State::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_3(State3 const& state3,It3 const& it3,F& f)
{
return unrolled_fold<
Result
, N-4
>::call(
f(state3,fusion::deref(it3)),
fusion::next(it3),
f);
}
template<typename State2, typename It2, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_2(State2 const& state2,It2 const& it2,F& f)
{
return call_3(
f(state2,fusion::deref(it2)),
fusion::next(it2),
f);
}
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,fusion::deref(it1)),
fusion::next(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::next(it0),
f);
}
}; };
template<typename Result> template<int SeqSize, typename It, typename State, typename F>
struct unrolled_fold<Result,3> struct result_of_it_fold<SeqSize,It,State,F
{
template<typename State2, typename It2, typename F> , typename boost::enable_if_has_type<
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename boost::disable_if_c<SeqSize == 0, State>::type::type
static Result >::type>
call_2(State2 const& state2,It2 const& it2,F& f) : result_of_it_fold<
{ SeqSize-1
return f(state2,fusion::deref(it2)); , typename result_of::next<It>::type
} , boost::result_of<
template<typename State1, typename It1, typename F> F(
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename add_reference<typename State::type>::type,
static Result typename fusion::result_of::deref<It const>::type
call_1(State1 const& state1,It1 const& it1,F& f) )
{ >
return call_2(
f(state1,fusion::deref(it1)),
fusion::next(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::next(it0),
f);
}
};
template<typename Result>
struct unrolled_fold<Result,2>
{
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return f(state1,fusion::deref(it1));
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::next(it0),
f);
}
};
template<typename Result>
struct unrolled_fold<Result,1>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return f(state,
fusion::deref(it0));
}
};
template<typename Result>
struct unrolled_fold<Result,0>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
return static_cast<Result>(state);
}
};
template<typename StateRef, typename It0, typename F, int N>
struct result_of_unrolled_fold
{
typedef typename
fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::next<
It0 const
>::type
it1;
typedef typename
fold_lvalue_state<
rest1
, it1
, F
>::type
rest2;
typedef typename
result_of::next<it1>::type
it2;
typedef typename
fold_lvalue_state<
rest2
, it2
, F
>::type
rest3;
typedef typename
result_of::next<it2>::type
it3;
typedef typename
result_of_unrolled_fold<
typename fold_lvalue_state<
rest3
, it3
, F
>::type
, typename result_of::next<
it3
>::type
, F
, N-4
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_fold<
StateRef
, It0
, F
, 3
>
{
typedef typename
fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::next<
It0 const
>::type
it1;
typedef typename
fold_lvalue_state<
typename fold_lvalue_state<
rest1
, it1
, F
>::type
, typename result_of::next<
it1 const
>::type const
, F
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_fold<
StateRef
, It0
, F
, 2
>
: fold_lvalue_state<
typename fold_lvalue_state<
StateRef
, It0 const
, F
>::type
, typename result_of::next<
It0 const
>::type const
, F , F
> >
{}; {};
template<typename StateRef, typename It0, typename F> template<typename It, typename State, typename F>
struct result_of_unrolled_fold< BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
StateRef inline typename result_of_it_fold<
, It0 0
, It
, State
, F , F
, 1 >::type
> it_fold(mpl::int_<0>, It const&, typename State::type state, F&)
: fold_lvalue_state< {
StateRef return state;
, It0 const }
template<typename It, typename State, typename F, int SeqSize>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename lazy_enable_if_c<
SeqSize != 0
, result_of_it_fold<
SeqSize
, It
, State
, F , F
> >
{}; >::type
template<typename StateRef, typename It0, typename F> it_fold(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
struct result_of_unrolled_fold<
StateRef
, It0
, F
, 0
>
{ {
typedef StateRef type; return it_fold<
}; typename result_of::next<It>::type
template<typename StateRef, typename It0, typename F, int SeqSize> , boost::result_of<
struct result_of_first_unrolledfold F(
{ typename add_reference<typename State::type>::type,
typedef typename typename fusion::result_of::deref<It const>::type
result_of_unrolled_fold< )
typename fusion::detail::result_of_with_decltype< >
F( , F
StateRef, >(
typename fusion::result_of::deref< It0 const>::type mpl::int_<SeqSize-1>()
) , fusion::next(it)
>::type , f(state, fusion::deref(it))
, typename result_of::next< , f
It0 const );
>::type }
, F template<typename Seq, typename State, typename F
, SeqSize-1 , bool = traits::is_sequence<Seq>::value
>::type , bool = traits::is_segmented<Seq>::value>
type;
};
template<int SeqSize, typename StateRef, typename Seq, typename F>
struct fold_impl
{
typedef typename
result_of_first_unrolledfold<
StateRef
, typename result_of::begin<Seq>::type
, F
, SeqSize
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
typedef
unrolled_fold<
type
, SeqSize
>
unrolled_impl;
return unrolled_impl::call(
state,
fusion::begin(seq),
f);
}
};
template<typename StateRef, typename Seq, typename F>
struct fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
return static_cast<StateRef>(state);
}
};
template<typename Seq, typename State, typename F, bool IsSegmented>
struct result_of_fold struct result_of_fold
: fold_impl< {};
template<typename Seq, typename State, typename F>
struct result_of_fold<Seq, State, F, true, false>
: result_of_it_fold<
result_of::size<Seq>::value result_of::size<Seq>::value
, typename add_reference< , typename result_of::begin<Seq>::type
typename add_const<State>::type , add_reference<State>
>::type
, Seq
, F , F
> >
{}; {};
template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of_fold<Seq, State, F>::type
fold(Seq& seq, State& state, F& f)
{
return it_fold<
typename result_of::begin<Seq>::type
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
, fusion::begin(seq)
, state
, f
);
}
} }
namespace result_of namespace result_of
{ {
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
struct fold struct fold
: detail::result_of_fold< : detail::result_of_fold<Seq, State, F>
Seq
, State
, F
, traits::is_segmented<Seq>::type::value
>
{}; {};
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
@ -358,10 +127,7 @@ namespace boost { namespace fusion
>::type >::type
fold(Seq& seq, State const& state, F f) fold(Seq& seq, State const& state, F f)
{ {
return result_of::fold<Seq,State const,F>::call( return detail::fold<Seq, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
@ -372,37 +138,28 @@ namespace boost { namespace fusion
>::type >::type
fold(Seq const& seq, State const& state, F f) fold(Seq const& seq, State const& state, F f)
{ {
return result_of::fold<Seq const,State const,F>::call( return detail::fold<Seq const, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold< inline typename result_of::fold<
Seq Seq
, State const , State
, F , F
>::type >::type
fold(Seq& seq, State& state, F f) fold(Seq& seq, State& state, F f)
{ {
return result_of::fold<Seq,State,F>::call( return detail::fold<Seq, State, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold< inline typename result_of::fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
fold(Seq const& seq, State& state, F f) fold(Seq const& seq, State& state, F f)
{ {
return result_of::fold<Seq const,State,F>::call( return detail::fold<Seq const, State, F>(seq, state, f);
state,
seq,
f);
} }
}} }}

View File

@ -11,341 +11,110 @@ namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<typename State, typename It, typename F> template<int SeqSize, typename It, typename State, typename F, typename = void>
struct iter_fold_lvalue_state struct result_of_it_iter_fold
: fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
It&)
>
{}; {};
template<typename Result,int N> template<typename It, typename State, typename F>
struct unrolled_iter_fold struct result_of_it_iter_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type>
{ {
template<typename State3, typename It3, typename F> typedef typename State::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_3(State3 const& state3,It3 const& it3,F& f)
{
return unrolled_iter_fold<
Result
, N-4
>::call(
f(state3,it3),
fusion::next(it3),
f);
}
template<typename State2, typename It2, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_2(State2 const& state2,It2 const& it2,F& f)
{
return call_3(
f(state2,it2),
fusion::next(it2),
f);
}
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,it1),
fusion::next(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::next(it0),
f);
}
}; };
template<typename Result> template<int SeqSize, typename It, typename State, typename F>
struct unrolled_iter_fold<Result,3> struct result_of_it_iter_fold<SeqSize,It,State,F
{
template<typename State2, typename It2, typename F> , typename boost::enable_if_has_type<
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename boost::disable_if_c<SeqSize == 0, State>::type::type
static Result >::type>
call_2(State2 const& state2,It2 const& it2,F& f) : result_of_it_iter_fold<
{ SeqSize-1
return f(state2,it2); , typename result_of::next<It>::type
} , boost::result_of<
template<typename State1, typename It1, typename F> F(
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename add_reference<typename State::type>::type,
static Result It const&
call_1(State1 const& state1,It1 const& it1,F& f) )
{ >
return call_2(
f(state1,it1),
fusion::next(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::next(it0),
f);
}
};
template<typename Result>
struct unrolled_iter_fold<Result,2>
{
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return f(state1,it1);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::next(it0),
f);
}
};
template<typename Result>
struct unrolled_iter_fold<Result,1>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return f(state,
it0);
}
};
template<typename Result>
struct unrolled_iter_fold<Result,0>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
return static_cast<Result>(state);
}
};
template<typename StateRef, typename It0, typename F, int N>
struct result_of_unrolled_iter_fold
{
typedef typename
iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::next<
It0 const
>::type
it1;
typedef typename
iter_fold_lvalue_state<
rest1
, it1
, F
>::type
rest2;
typedef typename
result_of::next<it1>::type
it2;
typedef typename
iter_fold_lvalue_state<
rest2
, it2
, F
>::type
rest3;
typedef typename
result_of::next<it2>::type
it3;
typedef typename
result_of_unrolled_iter_fold<
typename iter_fold_lvalue_state<
rest3
, it3
, F
>::type
, typename result_of::next<
it3
>::type
, F
, N-4
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_iter_fold<
StateRef
, It0
, F
, 3
>
{
typedef typename
iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::next<
It0 const
>::type
it1;
typedef typename
iter_fold_lvalue_state<
typename iter_fold_lvalue_state<
rest1
, it1
, F
>::type
, typename result_of::next<
it1 const
>::type const
, F
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_iter_fold<
StateRef
, It0
, F
, 2
>
: iter_fold_lvalue_state<
typename iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
, typename result_of::next<
It0 const
>::type const
, F , F
> >
{}; {};
template<typename StateRef, typename It0, typename F> template<typename It, typename State, typename F>
struct result_of_unrolled_iter_fold< BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
StateRef inline typename result_of_it_iter_fold<
, It0 0
, It
, State
, F , F
, 1 >::type
> it_iter_fold(mpl::int_<0>, It const&, typename State::type state, F&)
: iter_fold_lvalue_state< {
StateRef return state;
, It0 const }
template<typename It, typename State, typename F, int SeqSize>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename lazy_enable_if_c<
SeqSize != 0
, result_of_it_iter_fold<
SeqSize
, It
, State
, F , F
> >
{}; >::type
template<typename StateRef, typename It0, typename F> it_iter_fold(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
struct result_of_unrolled_iter_fold<
StateRef
, It0
, F
, 0
>
{ {
typedef StateRef type; return it_iter_fold<
}; typename result_of::next<It>::type
template<typename StateRef, typename It0, typename F, int SeqSize> , boost::result_of<
struct result_of_first_unrollediter_fold F(
{ typename add_reference<typename State::type>::type,
typedef typename It const&
result_of_unrolled_iter_fold< )
typename fusion::detail::result_of_with_decltype< >
F( , F
StateRef, >(
It0 const& mpl::int_<SeqSize-1>()
) , fusion::next(it)
>::type , f(state, it)
, typename result_of::next< , f
It0 const );
>::type }
, F template<typename Seq, typename State, typename F
, SeqSize-1 , bool = traits::is_sequence<Seq>::value
>::type , bool = traits::is_segmented<Seq>::value>
type;
};
template<int SeqSize, typename StateRef, typename Seq, typename F>
struct iter_fold_impl
{
typedef typename
result_of_first_unrollediter_fold<
StateRef
, typename result_of::begin<Seq>::type
, F
, SeqSize
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
typedef
unrolled_iter_fold<
type
, SeqSize
>
unrolled_impl;
return unrolled_impl::call(
state,
fusion::begin(seq),
f);
}
};
template<typename StateRef, typename Seq, typename F>
struct iter_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
return static_cast<StateRef>(state);
}
};
template<typename Seq, typename State, typename F, bool IsSegmented>
struct result_of_iter_fold struct result_of_iter_fold
: iter_fold_impl< {};
template<typename Seq, typename State, typename F>
struct result_of_iter_fold<Seq, State, F, true, false>
: result_of_it_iter_fold<
result_of::size<Seq>::value result_of::size<Seq>::value
, typename add_reference< , typename result_of::begin<Seq>::type
typename add_const<State>::type , add_reference<State>
>::type
, Seq
, F , F
> >
{}; {};
template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of_iter_fold<Seq, State, F>::type
iter_fold(Seq& seq, State& state, F& f)
{
return it_iter_fold<
typename result_of::begin<Seq>::type
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
, fusion::begin(seq)
, state
, f
);
}
} }
namespace result_of namespace result_of
{ {
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
struct iter_fold struct iter_fold
: detail::result_of_iter_fold< : detail::result_of_iter_fold<Seq, State, F>
Seq
, State
, F
, traits::is_segmented<Seq>::type::value
>
{}; {};
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
@ -357,10 +126,7 @@ namespace boost { namespace fusion
>::type >::type
iter_fold(Seq& seq, State const& state, F f) iter_fold(Seq& seq, State const& state, F f)
{ {
return result_of::iter_fold<Seq,State const,F>::call( return detail::iter_fold<Seq, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
@ -371,37 +137,28 @@ namespace boost { namespace fusion
>::type >::type
iter_fold(Seq const& seq, State const& state, F f) iter_fold(Seq const& seq, State const& state, F f)
{ {
return result_of::iter_fold<Seq const,State const,F>::call( return detail::iter_fold<Seq const, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold< inline typename result_of::iter_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
iter_fold(Seq& seq, State& state, F f) iter_fold(Seq& seq, State& state, F f)
{ {
return result_of::iter_fold<Seq,State,F>::call( return detail::iter_fold<Seq, State, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold< inline typename result_of::iter_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
iter_fold(Seq const& seq, State& state, F f) iter_fold(Seq const& seq, State& state, F f)
{ {
return result_of::iter_fold<Seq const,State,F>::call( return detail::iter_fold<Seq const, State, F>(seq, state, f);
state,
seq,
f);
} }
}} }}

View File

@ -11,341 +11,110 @@ namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<typename State, typename It, typename F> template<int SeqSize, typename It, typename State, typename F, typename = void>
struct reverse_fold_lvalue_state struct result_of_it_reverse_fold
: fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
typename fusion::result_of::deref<It>::type)
>
{}; {};
template<typename Result,int N> template<typename It, typename State, typename F>
struct unrolled_reverse_fold struct result_of_it_reverse_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type>
{ {
template<typename State3, typename It3, typename F> typedef typename State::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_3(State3 const& state3,It3 const& it3,F& f)
{
return unrolled_reverse_fold<
Result
, N-4
>::call(
f(state3,fusion::deref(it3)),
fusion::prior(it3),
f);
}
template<typename State2, typename It2, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_2(State2 const& state2,It2 const& it2,F& f)
{
return call_3(
f(state2,fusion::deref(it2)),
fusion::prior(it2),
f);
}
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,fusion::deref(it1)),
fusion::prior(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::prior(it0),
f);
}
}; };
template<typename Result> template<int SeqSize, typename It, typename State, typename F>
struct unrolled_reverse_fold<Result,3> struct result_of_it_reverse_fold<SeqSize,It,State,F
{
template<typename State2, typename It2, typename F> , typename boost::enable_if_has_type<
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename boost::disable_if_c<SeqSize == 0, State>::type::type
static Result >::type>
call_2(State2 const& state2,It2 const& it2,F& f) : result_of_it_reverse_fold<
{ SeqSize-1
return f(state2,fusion::deref(it2)); , typename result_of::prior<It>::type
} , boost::result_of<
template<typename State1, typename It1, typename F> F(
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename add_reference<typename State::type>::type,
static Result typename fusion::result_of::deref<It const>::type
call_1(State1 const& state1,It1 const& it1,F& f) )
{ >
return call_2(
f(state1,fusion::deref(it1)),
fusion::prior(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::prior(it0),
f);
}
};
template<typename Result>
struct unrolled_reverse_fold<Result,2>
{
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return f(state1,fusion::deref(it1));
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,fusion::deref(it0)),
fusion::prior(it0),
f);
}
};
template<typename Result>
struct unrolled_reverse_fold<Result,1>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return f(state,
fusion::deref(it0));
}
};
template<typename Result>
struct unrolled_reverse_fold<Result,0>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
return static_cast<Result>(state);
}
};
template<typename StateRef, typename It0, typename F, int N>
struct result_of_unrolled_reverse_fold
{
typedef typename
reverse_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::prior<
It0 const
>::type
it1;
typedef typename
reverse_fold_lvalue_state<
rest1
, it1
, F
>::type
rest2;
typedef typename
result_of::prior<it1>::type
it2;
typedef typename
reverse_fold_lvalue_state<
rest2
, it2
, F
>::type
rest3;
typedef typename
result_of::prior<it2>::type
it3;
typedef typename
result_of_unrolled_reverse_fold<
typename reverse_fold_lvalue_state<
rest3
, it3
, F
>::type
, typename result_of::prior<
it3
>::type
, F
, N-4
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_reverse_fold<
StateRef
, It0
, F
, 3
>
{
typedef typename
reverse_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::prior<
It0 const
>::type
it1;
typedef typename
reverse_fold_lvalue_state<
typename reverse_fold_lvalue_state<
rest1
, it1
, F
>::type
, typename result_of::prior<
it1 const
>::type const
, F
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_reverse_fold<
StateRef
, It0
, F
, 2
>
: reverse_fold_lvalue_state<
typename reverse_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
, typename result_of::prior<
It0 const
>::type const
, F , F
> >
{}; {};
template<typename StateRef, typename It0, typename F> template<typename It, typename State, typename F>
struct result_of_unrolled_reverse_fold< BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
StateRef inline typename result_of_it_reverse_fold<
, It0 0
, It
, State
, F , F
, 1 >::type
> it_reverse_fold(mpl::int_<0>, It const&, typename State::type state, F&)
: reverse_fold_lvalue_state< {
StateRef return state;
, It0 const }
template<typename It, typename State, typename F, int SeqSize>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename lazy_enable_if_c<
SeqSize != 0
, result_of_it_reverse_fold<
SeqSize
, It
, State
, F , F
> >
{}; >::type
template<typename StateRef, typename It0, typename F> it_reverse_fold(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
struct result_of_unrolled_reverse_fold<
StateRef
, It0
, F
, 0
>
{ {
typedef StateRef type; return it_reverse_fold<
}; typename result_of::prior<It>::type
template<typename StateRef, typename It0, typename F, int SeqSize> , boost::result_of<
struct result_of_first_unrolledreverse_fold F(
{ typename add_reference<typename State::type>::type,
typedef typename typename fusion::result_of::deref<It const>::type
result_of_unrolled_reverse_fold< )
typename fusion::detail::result_of_with_decltype< >
F( , F
StateRef, >(
typename fusion::result_of::deref< It0 const>::type mpl::int_<SeqSize-1>()
) , fusion::prior(it)
>::type , f(state, fusion::deref(it))
, typename result_of::prior< , f
It0 const );
>::type }
, F template<typename Seq, typename State, typename F
, SeqSize-1 , bool = traits::is_sequence<Seq>::value
>::type , bool = traits::is_segmented<Seq>::value>
type;
};
template<int SeqSize, typename StateRef, typename Seq, typename F>
struct reverse_fold_impl
{
typedef typename
result_of_first_unrolledreverse_fold<
StateRef
, typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
, F
, SeqSize
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
typedef
unrolled_reverse_fold<
type
, SeqSize
>
unrolled_impl;
return unrolled_impl::call(
state,
fusion::prior( fusion::end(seq)),
f);
}
};
template<typename StateRef, typename Seq, typename F>
struct reverse_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
return static_cast<StateRef>(state);
}
};
template<typename Seq, typename State, typename F, bool IsSegmented>
struct result_of_reverse_fold struct result_of_reverse_fold
: reverse_fold_impl< {};
template<typename Seq, typename State, typename F>
struct result_of_reverse_fold<Seq, State, F, true, false>
: result_of_it_reverse_fold<
result_of::size<Seq>::value result_of::size<Seq>::value
, typename add_reference< , typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
typename add_const<State>::type , add_reference<State>
>::type
, Seq
, F , F
> >
{}; {};
template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of_reverse_fold<Seq, State, F>::type
reverse_fold(Seq& seq, State& state, F& f)
{
return it_reverse_fold<
typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
, fusion::prior( fusion::end(seq) )
, state
, f
);
}
} }
namespace result_of namespace result_of
{ {
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
struct reverse_fold struct reverse_fold
: detail::result_of_reverse_fold< : detail::result_of_reverse_fold<Seq, State, F>
Seq
, State
, F
, traits::is_segmented<Seq>::type::value
>
{}; {};
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
@ -357,10 +126,7 @@ namespace boost { namespace fusion
>::type >::type
reverse_fold(Seq& seq, State const& state, F f) reverse_fold(Seq& seq, State const& state, F f)
{ {
return result_of::reverse_fold<Seq,State const,F>::call( return detail::reverse_fold<Seq, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
@ -371,37 +137,28 @@ namespace boost { namespace fusion
>::type >::type
reverse_fold(Seq const& seq, State const& state, F f) reverse_fold(Seq const& seq, State const& state, F f)
{ {
return result_of::reverse_fold<Seq const,State const,F>::call( return detail::reverse_fold<Seq const, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold< inline typename result_of::reverse_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
reverse_fold(Seq& seq, State& state, F f) reverse_fold(Seq& seq, State& state, F f)
{ {
return result_of::reverse_fold<Seq,State,F>::call( return detail::reverse_fold<Seq, State, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold< inline typename result_of::reverse_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
reverse_fold(Seq const& seq, State& state, F f) reverse_fold(Seq const& seq, State& state, F f)
{ {
return result_of::reverse_fold<Seq const,State,F>::call( return detail::reverse_fold<Seq const, State, F>(seq, state, f);
state,
seq,
f);
} }
}} }}

View File

@ -11,341 +11,110 @@ namespace boost { namespace fusion
{ {
namespace detail namespace detail
{ {
template<typename State, typename It, typename F> template<int SeqSize, typename It, typename State, typename F, typename = void>
struct reverse_iter_fold_lvalue_state struct result_of_it_reverse_iter_fold
: fusion::detail::result_of_with_decltype<
F(
typename add_reference<typename add_const<State>::type>::type,
It&)
>
{}; {};
template<typename Result,int N> template<typename It, typename State, typename F>
struct unrolled_reverse_iter_fold struct result_of_it_reverse_iter_fold<0,It,State,F
, typename boost::enable_if_has_type<typename State::type>::type>
{ {
template<typename State3, typename It3, typename F> typedef typename State::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_3(State3 const& state3,It3 const& it3,F& f)
{
return unrolled_reverse_iter_fold<
Result
, N-4
>::call(
f(state3,it3),
fusion::prior(it3),
f);
}
template<typename State2, typename It2, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_2(State2 const& state2,It2 const& it2,F& f)
{
return call_3(
f(state2,it2),
fusion::prior(it2),
f);
}
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return call_2(
f(state1,it1),
fusion::prior(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::prior(it0),
f);
}
}; };
template<typename Result> template<int SeqSize, typename It, typename State, typename F>
struct unrolled_reverse_iter_fold<Result,3> struct result_of_it_reverse_iter_fold<SeqSize,It,State,F
{
template<typename State2, typename It2, typename F> , typename boost::enable_if_has_type<
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename boost::disable_if_c<SeqSize == 0, State>::type::type
static Result >::type>
call_2(State2 const& state2,It2 const& it2,F& f) : result_of_it_reverse_iter_fold<
{ SeqSize-1
return f(state2,it2); , typename result_of::prior<It>::type
} , boost::result_of<
template<typename State1, typename It1, typename F> F(
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED typename add_reference<typename State::type>::type,
static Result It const&
call_1(State1 const& state1,It1 const& it1,F& f) )
{ >
return call_2(
f(state1,it1),
fusion::prior(it1),
f);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::prior(it0),
f);
}
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,2>
{
template<typename State1, typename It1, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call_1(State1 const& state1,It1 const& it1,F& f)
{
return f(state1,it1);
}
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return call_1(
f(state,it0),
fusion::prior(it0),
f);
}
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,1>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const& it0,F f)
{
return f(state,
it0);
}
};
template<typename Result>
struct unrolled_reverse_iter_fold<Result,0>
{
template<typename State, typename It0, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static Result
call(State const& state,It0 const&, F)
{
return static_cast<Result>(state);
}
};
template<typename StateRef, typename It0, typename F, int N>
struct result_of_unrolled_reverse_iter_fold
{
typedef typename
reverse_iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::prior<
It0 const
>::type
it1;
typedef typename
reverse_iter_fold_lvalue_state<
rest1
, it1
, F
>::type
rest2;
typedef typename
result_of::prior<it1>::type
it2;
typedef typename
reverse_iter_fold_lvalue_state<
rest2
, it2
, F
>::type
rest3;
typedef typename
result_of::prior<it2>::type
it3;
typedef typename
result_of_unrolled_reverse_iter_fold<
typename reverse_iter_fold_lvalue_state<
rest3
, it3
, F
>::type
, typename result_of::prior<
it3
>::type
, F
, N-4
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_reverse_iter_fold<
StateRef
, It0
, F
, 3
>
{
typedef typename
reverse_iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
rest1;
typedef typename
result_of::prior<
It0 const
>::type
it1;
typedef typename
reverse_iter_fold_lvalue_state<
typename reverse_iter_fold_lvalue_state<
rest1
, it1
, F
>::type
, typename result_of::prior<
it1 const
>::type const
, F
>::type
type;
};
template<typename StateRef, typename It0, typename F>
struct result_of_unrolled_reverse_iter_fold<
StateRef
, It0
, F
, 2
>
: reverse_iter_fold_lvalue_state<
typename reverse_iter_fold_lvalue_state<
StateRef
, It0 const
, F
>::type
, typename result_of::prior<
It0 const
>::type const
, F , F
> >
{}; {};
template<typename StateRef, typename It0, typename F> template<typename It, typename State, typename F>
struct result_of_unrolled_reverse_iter_fold< BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
StateRef inline typename result_of_it_reverse_iter_fold<
, It0 0
, It
, State
, F , F
, 1 >::type
> it_reverse_iter_fold(mpl::int_<0>, It const&, typename State::type state, F&)
: reverse_iter_fold_lvalue_state< {
StateRef return state;
, It0 const }
template<typename It, typename State, typename F, int SeqSize>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename lazy_enable_if_c<
SeqSize != 0
, result_of_it_reverse_iter_fold<
SeqSize
, It
, State
, F , F
> >
{}; >::type
template<typename StateRef, typename It0, typename F> it_reverse_iter_fold(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
struct result_of_unrolled_reverse_iter_fold<
StateRef
, It0
, F
, 0
>
{ {
typedef StateRef type; return it_reverse_iter_fold<
}; typename result_of::prior<It>::type
template<typename StateRef, typename It0, typename F, int SeqSize> , boost::result_of<
struct result_of_first_unrolledreverse_iter_fold F(
{ typename add_reference<typename State::type>::type,
typedef typename It const&
result_of_unrolled_reverse_iter_fold< )
typename fusion::detail::result_of_with_decltype< >
F( , F
StateRef, >(
It0 const& mpl::int_<SeqSize-1>()
) , fusion::prior(it)
>::type , f(state, it)
, typename result_of::prior< , f
It0 const );
>::type }
, F template<typename Seq, typename State, typename F
, SeqSize-1 , bool = traits::is_sequence<Seq>::value
>::type , bool = traits::is_segmented<Seq>::value>
type;
};
template<int SeqSize, typename StateRef, typename Seq, typename F>
struct reverse_iter_fold_impl
{
typedef typename
result_of_first_unrolledreverse_iter_fold<
StateRef
, typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
, F
, SeqSize
>::type
type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(StateRef state, Seq& seq, F f)
{
typedef
unrolled_reverse_iter_fold<
type
, SeqSize
>
unrolled_impl;
return unrolled_impl::call(
state,
fusion::prior( fusion::end(seq)),
f);
}
};
template<typename StateRef, typename Seq, typename F>
struct reverse_iter_fold_impl<0,StateRef,Seq,F>
{
typedef StateRef type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static StateRef
call(StateRef state, Seq&, F)
{
return static_cast<StateRef>(state);
}
};
template<typename Seq, typename State, typename F, bool IsSegmented>
struct result_of_reverse_iter_fold struct result_of_reverse_iter_fold
: reverse_iter_fold_impl< {};
template<typename Seq, typename State, typename F>
struct result_of_reverse_iter_fold<Seq, State, F, true, false>
: result_of_it_reverse_iter_fold<
result_of::size<Seq>::value result_of::size<Seq>::value
, typename add_reference< , typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
typename add_const<State>::type , add_reference<State>
>::type
, Seq
, F , F
> >
{}; {};
template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of_reverse_iter_fold<Seq, State, F>::type
reverse_iter_fold(Seq& seq, State& state, F& f)
{
return it_reverse_iter_fold<
typename fusion::result_of::prior< typename result_of::end<Seq>::type >::type
, add_reference<State>
, F
>(
typename result_of::size<Seq>::type()
, fusion::prior( fusion::end(seq) )
, state
, f
);
}
} }
namespace result_of namespace result_of
{ {
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
struct reverse_iter_fold struct reverse_iter_fold
: detail::result_of_reverse_iter_fold< : detail::result_of_reverse_iter_fold<Seq, State, F>
Seq
, State
, F
, traits::is_segmented<Seq>::type::value
>
{}; {};
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
@ -357,10 +126,7 @@ namespace boost { namespace fusion
>::type >::type
reverse_iter_fold(Seq& seq, State const& state, F f) reverse_iter_fold(Seq& seq, State const& state, F f)
{ {
return result_of::reverse_iter_fold<Seq,State const,F>::call( return detail::reverse_iter_fold<Seq, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
@ -371,37 +137,28 @@ namespace boost { namespace fusion
>::type >::type
reverse_iter_fold(Seq const& seq, State const& state, F f) reverse_iter_fold(Seq const& seq, State const& state, F f)
{ {
return result_of::reverse_iter_fold<Seq const,State const,F>::call( return detail::reverse_iter_fold<Seq const, State const, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold< inline typename result_of::reverse_iter_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
reverse_iter_fold(Seq& seq, State& state, F f) reverse_iter_fold(Seq& seq, State& state, F f)
{ {
return result_of::reverse_iter_fold<Seq,State,F>::call( return detail::reverse_iter_fold<Seq, State, F>(seq, state, f);
state,
seq,
f);
} }
template<typename Seq, typename State, typename F> template<typename Seq, typename State, typename F>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold< inline typename result_of::reverse_iter_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
reverse_iter_fold(Seq const& seq, State& state, F f) reverse_iter_fold(Seq const& seq, State& state, F f)
{ {
return result_of::reverse_iter_fold<Seq const,State,F>::call( return detail::reverse_iter_fold<Seq const, State, F>(seq, state, f);
state,
seq,
f);
} }
}} }}

View File

@ -10,6 +10,7 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/iteration/fold_fwd.hpp> #include <boost/fusion/algorithm/iteration/fold_fwd.hpp>
#include <boost/fusion/support/segmented_fold_until.hpp> #include <boost/fusion/support/segmented_fold_until.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion { namespace detail namespace boost { namespace fusion { namespace detail
{ {
@ -38,11 +39,11 @@ namespace boost { namespace fusion { namespace detail
}; };
// The default implementation of this lives in detail/fold.hpp // The default implementation of this lives in detail/fold.hpp
template <typename Sequence, typename State, typename Fun, bool IsSegmented> template <typename Sequence, typename State, typename Fun, bool IsSequence, bool IsSegmented>
struct result_of_fold; struct result_of_fold;
template <typename Sequence, typename State, typename Fun> template <typename Sequence, typename State, typename Fun>
struct result_of_fold<Sequence, State, Fun, true> struct result_of_fold<Sequence, State, Fun, true, true>
{ {
typedef typedef
typename result_of::segmented_fold_until< typename result_of::segmented_fold_until<
@ -53,7 +54,7 @@ namespace boost { namespace fusion { namespace detail
type; type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(State& state, Sequence& seq, Fun fun) static type call(Sequence& seq, State& state, Fun& fun)
{ {
return fusion::segmented_fold_until(seq, state, segmented_fold_fun<Fun>(fun)); return fusion::segmented_fold_until(seq, state, segmented_fold_fun<Fun>(fun));
} }

View File

@ -2,6 +2,7 @@
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2007 Dan Marsden Copyright (c) 2007 Dan Marsden
Copyright (c) 2009-2010 Christopher Schmidt Copyright (c) 2009-2010 Christopher Schmidt
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -10,24 +11,17 @@
#define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP #define BOOST_FUSION_ALGORITHM_ITERATION_FOLD_HPP
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/result_of.hpp>
#include <boost/fusion/algorithm/iteration/fold_fwd.hpp> #include <boost/fusion/algorithm/iteration/fold_fwd.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp> #include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/utility/result_of.hpp> #include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES) #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold< inline typename result_of::fold<
Seq Seq
, State const , State
, F , F
>::type >::type
fold(Seq& seq, State& state, F f); fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::fold< inline typename result_of::fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
fold(Seq const& seq, State& state, F f); fold(Seq const& seq, State& state, F f);

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -13,20 +14,14 @@
#include <boost/fusion/algorithm/iteration/iter_fold_fwd.hpp> #include <boost/fusion/algorithm/iteration/iter_fold_fwd.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp> #include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/support/detail/result_of.hpp> #include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/next.hpp>
#include <boost/mpl/eval_if.hpp> #include <boost/utility/result_of.hpp>
#include <boost/mpl/if.hpp> #include <boost/core/enable_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_ITER_FOLD #define BOOST_FUSION_ITER_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold< inline typename result_of::iter_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
iter_fold(Seq& seq, State& state, F f); iter_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::iter_fold< inline typename result_of::iter_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
iter_fold(Seq const& seq, State& state, F f); iter_fold(Seq const& seq, State& state, F f);

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -10,24 +11,17 @@
#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_HPP #define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_FOLD_HPP
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/result_of.hpp>
#include <boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp> #include <boost/fusion/algorithm/iteration/reverse_fold_fwd.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp> #include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp> #include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/utility/result_of.hpp> #include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_REVERSE_FOLD #define BOOST_FUSION_REVERSE_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold< inline typename result_of::reverse_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
reverse_fold(Seq& seq, State& state, F f); reverse_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_fold< inline typename result_of::reverse_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
reverse_fold(Seq const& seq, State& state, F f); reverse_fold(Seq const& seq, State& state, F f);

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2010 Christopher Schmidt
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,24 +10,17 @@
#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_HPP #define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_HPP
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/result_of.hpp>
#include <boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp> #include <boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp> #include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp> #include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/utility/result_of.hpp> #include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp> #include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_REVERSE_FOLD #define BOOST_FUSION_REVERSE_FOLD

View File

@ -38,7 +38,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold< inline typename result_of::reverse_iter_fold<
Seq Seq
, State const , State
, F , F
>::type >::type
reverse_iter_fold(Seq& seq, State& state, F f); reverse_iter_fold(Seq& seq, State& state, F f);
@ -47,7 +47,7 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::reverse_iter_fold< inline typename result_of::reverse_iter_fold<
Seq const Seq const
, State const , State
, F , F
>::type >::type
reverse_iter_fold(Seq const& seq, State& state, F f); reverse_iter_fold(Seq const& seq, State& state, F f);

View File

@ -10,7 +10,6 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp> #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/view/joint_view/joint_view.hpp> #include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp> #include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp> #include <boost/fusion/support/detail/as_fusion_element.hpp>

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#ifndef BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED #ifndef BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED
#define BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED #define BOOST_FUSION_ALGORITHM_FLATTEN_HPP_INCLUDED

View File

@ -10,7 +10,6 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp> #include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp> #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/view/joint_view/joint_view.hpp> #include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/single_view/single_view.hpp> #include <boost/fusion/view/single_view/single_view.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp> #include <boost/fusion/view/iterator_range/iterator_range.hpp>

View File

@ -9,7 +9,6 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/mpl/convert_iterator.hpp> #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/view/joint_view/joint_view.hpp> #include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp> #include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp> #include <boost/fusion/support/detail/as_fusion_element.hpp>

View File

@ -149,7 +149,8 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit deque(Sequence const& seq explicit deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, Head> >::type* /*dummy*/ = 0) , typename disable_if<is_convertible<Sequence, Head> >::type* /*dummy*/ = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* /*dummy*/ = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2005-2012 Joel de Guzman Copyright (c) 2005-2012 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -12,7 +13,7 @@
#include <boost/fusion/container/deque/convert.hpp> #include <boost/fusion/container/deque/convert.hpp>
#include <boost/fusion/container/deque/deque.hpp> #include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -41,7 +42,11 @@ namespace boost { namespace fusion
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq) static type call(Sequence& seq)
{ {
return gen::call(seq); return gen::call(fusion::begin(seq)
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
, fusion::end(seq)
#endif
);
} }
}; };
}; };

View File

@ -22,6 +22,7 @@ namespace boost { namespace fusion
{ {
template <typename Sequence> template <typename Sequence>
struct as_deque struct as_deque
: detail::as_deque<result_of::size<Sequence>::value>
{ {
typedef typename typedef typename
detail::as_deque<result_of::size<Sequence>::value> detail::as_deque<result_of::size<Sequence>::value>

View File

@ -101,7 +101,9 @@ namespace boost { namespace fusion {
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
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
, typename enable_if<traits::is_sequence<Sequence> >::type* /*dummy*/ = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}

View File

@ -201,7 +201,9 @@ deque(T_0 && t0 , T_1 && t1 , T_2 && t2 , T_3 && t3 , T_4 && t4 , T_5 && t5 , T_
{} {}
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* = 0) deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, T0> >::type* = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9> template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9>

View File

@ -381,7 +381,9 @@ deque(T_0 && t0 , T_1 && t1 , T_2 && t2 , T_3 && t3 , T_4 && t4 , T_5 && t5 , T_
{} {}
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* = 0) deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, T0> >::type* = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19> template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19>

View File

@ -561,7 +561,9 @@ deque(T_0 && t0 , T_1 && t1 , T_2 && t2 , T_3 && t3 , T_4 && t4 , T_5 && t5 , T_
{} {}
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* = 0) deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, T0> >::type* = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29> template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29>

View File

@ -741,7 +741,9 @@ deque(T_0 && t0 , T_1 && t1 , T_2 && t2 , T_3 && t3 , T_4 && t4 , T_5 && t5 , T_
{} {}
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* = 0) deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, T0> >::type* = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39> template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39>

View File

@ -921,7 +921,9 @@ deque(T_0 && t0 , T_1 && t1 , T_2 && t2 , T_3 && t3 , T_4 && t4 , T_5 && t5 , T_
{} {}
template<typename Sequence> template<typename Sequence>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* = 0) deque(Sequence const& seq
, typename disable_if<is_convertible<Sequence, T0> >::type* = 0
, typename enable_if<traits::is_sequence<Sequence> >::type* = 0)
: base(base::from_iterator(fusion::begin(seq))) : base(base::from_iterator(fusion::begin(seq)))
{} {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39 , typename U40 , typename U41 , typename U42 , typename U43 , typename U44 , typename U45 , typename U46 , typename U47 , typename U48 , typename U49> template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39 , typename U40 , typename U41 , typename U42 , typename U43 , typename U44 , typename U45 , typename U46 , typename U47 , typename U48 , typename U49>

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -10,7 +10,46 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/set/set.hpp> #include <boost/fusion/container/set/set.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# include <boost/fusion/container/generation/detail/pp_make_set.hpp> # include <boost/fusion/container/generation/detail/pp_make_set.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 variadic interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <utility>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename ...T>
struct make_set
{
typedef set<
typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...
> type;
};
}
template <typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::make_set<T...>::type
make_set(T&&... arg)
{
return typename result_of::make_set<T...>::type(std::forward<T>(arg)...);
}
}}
#endif #endif
#endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -10,7 +10,66 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector.hpp> #include <boost/fusion/container/vector/vector.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/generation/detail/pp_make_vector.hpp> # include <boost/fusion/container/generation/detail/pp_make_vector.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 variadic interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <utility>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename ...T>
struct make_vector
{
// make `make_vector<T..., void_...>' into `make_vector<T...>'
template <typename, typename...> struct trim_void;
template <typename... U>
struct trim_void<vector<U...> >
{
typedef vector<U...> type;
};
template <typename... U, typename... Tail>
struct trim_void<vector<U...>, void_, Tail...>
: trim_void<vector<U...> > { };
template <typename... U, typename Head, typename... Tail>
struct trim_void<vector<U...>, Head, Tail...>
: trim_void<vector<U..., Head>, Tail...> { };
typedef
typename trim_void<
vector<>
, typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...
>::type
type;
};
}
template <typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::make_vector<T...>::type
make_vector(T&&... arg)
{
return typename result_of::make_vector<T...>::type(std::forward<T>(arg)...);
}
}}
#endif #endif
#endif

View File

@ -8,8 +8,37 @@
#define FUSION_VECTOR_TIE_11112014_2302 #define FUSION_VECTOR_TIE_11112014_2302
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/generation/detail/pp_vector_tie.hpp> # include <boost/fusion/container/generation/detail/pp_vector_tie.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 variadic interface
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace fusion
{
namespace result_of
{
template <typename ...T>
struct vector_tie
{
typedef vector<T&...> type;
};
}
template <typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline vector<T&...>
vector_tie(T&... arg)
{
return vector<T&...>(arg...);
}
}}
#endif #endif
#endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -13,7 +13,55 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# include <boost/fusion/container/set/detail/cpp03/as_set.hpp> # include <boost/fusion/container/set/detail/cpp03/as_set.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/index_sequence.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <cstddef>
namespace boost { namespace fusion { namespace detail
{
BOOST_FUSION_BARRIER_BEGIN
template <int size
, typename = typename detail::make_index_sequence<size>::type>
struct as_set;
template <int size, std::size_t ...Indices>
struct as_set<size, detail::index_sequence<Indices...> >
{
template <typename I>
struct apply
{
typedef set<
typename result_of::value_of<
typename result_of::advance_c<I, Indices>::type
>::type...
> type;
};
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator const& i)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
return result(*advance_c<Indices>(i)...);
}
};
BOOST_FUSION_BARRIER_END
}}}
#endif #endif
#endif

View File

@ -29,7 +29,7 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
struct apply struct apply
{ {
typedef typename detail::as_set<result_of::size<Sequence>::value> gen; typedef detail::as_set<result_of::size<Sequence>::value> gen;
typedef typename gen:: typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type template apply<typename result_of::begin<Sequence>::type>::type
type; type;

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -13,8 +13,126 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# include <boost/fusion/container/set/detail/cpp03/set.hpp> # include <boost/fusion/container/set/detail/cpp03/set.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/is_same_size.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/set/detail/begin_impl.hpp>
#include <boost/fusion/container/set/detail/end_impl.hpp>
#include <boost/fusion/container/set/detail/value_of_impl.hpp>
#include <boost/fusion/container/set/detail/deref_data_impl.hpp>
#include <boost/fusion/container/set/detail/deref_impl.hpp>
#include <boost/fusion/container/set/detail/key_of_impl.hpp>
#include <boost/fusion/container/set/detail/value_of_data_impl.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/core/enable_if.hpp>
namespace boost { namespace fusion
{
struct fusion_sequence_tag;
template <>
struct set<> : sequence_base<set<> >
{
struct category : forward_traversal_tag, associative_tag {};
typedef set_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef vector<> storage_type;
typedef storage_type::size size;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
set()
: data() {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
set(Sequence const& rhs,
typename enable_if<traits::is_sequence<Sequence> >::type* = 0,
typename enable_if<detail::is_same_size<Sequence, storage_type> >::type* = 0)
: data(rhs) {}
template <typename T>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
set&
operator=(T const& rhs)
{
data = rhs;
return *this;
}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type& get_data() { return data; }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type const& get_data() const { return data; }
private:
storage_type data;
};
template <typename ...T>
struct set : sequence_base<set<T...> >
{
struct category : forward_traversal_tag, associative_tag {};
typedef set_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef vector<T...> storage_type;
typedef typename storage_type::size size;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
set()
: data() {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
set(Sequence&& rhs,
typename enable_if<traits::is_sequence<Sequence> >::type* = 0,
typename enable_if<detail::is_same_size<Sequence, storage_type> >::type* = 0)
: data(std::forward<Sequence>(rhs)) {}
template <typename ...U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit
set(U&& ...args)
: data(std::forward<U>(args)...) {}
template <typename U>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
set&
operator=(U&& rhs)
{
data = std::forward<U>(rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type& get_data() { return data; }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
storage_type const& get_data() const { return data; }
private:
storage_type data;
};
}}
#endif
#endif #endif

View File

@ -9,11 +9,38 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) \
|| (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
# if defined(BOOST_FUSION_HAS_VARIADIC_SET)
# undef BOOST_FUSION_HAS_VARIADIC_SET
# endif
#else
# if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# define BOOST_FUSION_HAS_VARIADIC_SET
# endif
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_SET)
# include <boost/fusion/container/set/detail/cpp03/set_fwd.hpp> # include <boost/fusion/container/set/detail/cpp03/set_fwd.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace fusion
{
struct set_tag;
struct set_iterator_tag;
template <typename ...T>
struct set;
}}
#endif #endif
#endif

View File

@ -8,25 +8,8 @@
#define FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602 #define FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/cpp03/limits.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#if (FUSION_MAX_VECTOR_SIZE > 10)
#include <boost/fusion/container/vector/vector20.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 20)
#include <boost/fusion/container/vector/vector30.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 30)
#include <boost/fusion/container/vector/vector40.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 40)
#include <boost/fusion/container/vector/vector50.hpp>
#endif
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp> #include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector_iterator.hpp> #include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/vector/convert.hpp> #include <boost/fusion/container/vector/convert.hpp>
#endif #endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -8,12 +8,63 @@
#define FUSION_AS_VECTOR_11052014_1801 #define FUSION_AS_VECTOR_11052014_1801
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/as_vector.hpp> # include <boost/fusion/container/vector/detail/cpp03/as_vector.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/index_sequence.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <cstddef>
namespace boost { namespace fusion { namespace detail
{
BOOST_FUSION_BARRIER_BEGIN
template <typename Indices>
struct as_vector_impl;
template <std::size_t ...Indices>
struct as_vector_impl<index_sequence<Indices...> >
{
template <typename Iterator>
struct apply
{
typedef vector<
typename result_of::value_of<
typename result_of::advance_c<Iterator, Indices>::type
>::type...
> type;
};
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator i)
{
typedef typename apply<Iterator>::type result;
return result(*advance_c<Indices>(i)...);
}
};
template <int size>
struct as_vector
: as_vector_impl<typename make_index_sequence<size>::type> {};
BOOST_FUSION_BARRIER_END
}}}
#endif
#endif #endif

View File

@ -9,9 +9,8 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp> #include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/mpl/at.hpp> #include <boost/static_assert.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -28,7 +27,7 @@ namespace boost { namespace fusion
template <typename Sequence, typename N> template <typename Sequence, typename N>
struct apply struct apply
{ {
typedef typename mpl::at<typename Sequence::types, N>::type element; typedef typename value_at_impl<vector_tag>::template apply<Sequence, N>::type element;
typedef typename detail::ref_result<element>::type type; typedef typename detail::ref_result<element>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
@ -43,7 +42,7 @@ namespace boost { namespace fusion
template <typename Sequence, typename N> template <typename Sequence, typename N>
struct apply <Sequence const, N> struct apply <Sequence const, N>
{ {
typedef typename mpl::at<typename Sequence::types, N>::type element; typedef typename value_at_impl<vector_tag>::template apply<Sequence, N>::type element;
typedef typename detail::cref_result<element>::type type; typedef typename detail::cref_result<element>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED

View File

@ -0,0 +1,36 @@
/*=============================================================================
Copyright (c) 2014-2015 Kohei Takahashi
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 FUSION_VECTOR_CONFIG_11052014_1720
#define FUSION_VECTOR_CONFIG_11052014_1720
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/fusion/support/config.hpp>
#if (defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \
|| defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \
|| defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \
|| defined(BOOST_NO_CXX11_DECLTYPE)) \
|| (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
# if defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# undef BOOST_FUSION_HAS_VARIADIC_VECTOR
# endif
#else
# if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# define BOOST_FUSION_HAS_VARIADIC_VECTOR
# endif
#endif
// Sometimes, MSVC 12 shows compile error with std::size_t of template parameter.
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800))
# if defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# undef BOOST_FUSION_HAS_VARIADIC_VECTOR
# endif
#endif
#endif

View File

@ -9,6 +9,7 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/pp_round.hpp> #include <boost/fusion/support/detail/pp_round.hpp>
#include <boost/preprocessor/stringize.hpp>
#if !defined(FUSION_MAX_VECTOR_SIZE) #if !defined(FUSION_MAX_VECTOR_SIZE)
# define FUSION_MAX_VECTOR_SIZE 10 # define FUSION_MAX_VECTOR_SIZE 10

View File

@ -8,8 +8,8 @@
#define FUSION_DEREF_IMPL_05042005_1037 #define FUSION_DEREF_IMPL_05042005_1037
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/at.hpp>
#include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_const.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
@ -30,9 +30,7 @@ namespace boost { namespace fusion
{ {
typedef typename Iterator::vector vector; typedef typename Iterator::vector vector;
typedef typename Iterator::index index; typedef typename Iterator::index index;
typedef typename mpl::at< typedef typename value_at_impl<vector_tag>::template apply<vector, index>::type element;
typename vector::types, index>::type
element;
typedef typename typedef typename
mpl::if_< mpl::if_<

View File

@ -9,11 +9,50 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp> # include <boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/remove_cv.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace vector_detail
{
template <typename I, typename ...T>
struct vector_data;
}
namespace extension
{
template <typename Tag>
struct value_at_impl;
template <>
struct value_at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename boost::remove_cv<Sequence>::type seq;
typedef decltype(seq::template value_at_impl<N::value>(boost::declval<seq*>())) type;
};
};
}
}}
#endif #endif
#endif

View File

@ -8,7 +8,7 @@
#define FUSION_VALUE_OF_IMPL_05052005_1128 #define FUSION_VALUE_OF_IMPL_05052005_1128
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/at.hpp> #include <boost/fusion/container/vector/detail/value_at_impl.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -27,9 +27,7 @@ namespace boost { namespace fusion
{ {
typedef typename Iterator::vector vector; typedef typename Iterator::vector vector;
typedef typename Iterator::index index; typedef typename Iterator::index index;
typedef typename mpl::at< typedef typename value_at_impl<vector_tag>::template apply<vector, index>::type type;
typename vector::types, index>::type
type;
}; };
}; };
} }

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,12 +9,333 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp> #include <boost/fusion/container/vector/vector_fwd.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/index_sequence.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <cstddef>
#include <utility>
namespace boost { namespace fusion
{
struct vector_tag;
struct random_access_traversal_tag;
namespace vector_detail
{
struct each_elem {};
struct copy_or_move {};
template <typename I> struct from_sequence {};
template <typename Sequence>
struct make_indices_from_seq
: detail::make_index_sequence<
fusion::result_of::size<typename remove_reference<Sequence>::type>::value
>
{};
template <typename T>
struct pure : remove_cv<typename remove_reference<T>::type> {};
template <typename Sequence, typename This, int = result_of::size<This>::value>
struct is_convertible_to_first
: boost::is_convertible<Sequence, typename result_of::value_at_c<This, 0>::type>
{};
template <typename Sequence, typename This>
struct is_convertible_to_first<Sequence, This, 0>
: mpl::false_
{};
template <typename This, typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline each_elem
dispatch(T const&...) BOOST_NOEXCEPT { return each_elem(); }
template <typename This>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline copy_or_move
dispatch(This const&) BOOST_NOEXCEPT { return copy_or_move(); }
template <typename This, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline from_sequence<
typename lazy_enable_if_c<
(traits::is_sequence<typename remove_reference<Sequence>::type>::value &&
!is_same<This, typename pure<Sequence>::type>::value &&
!is_convertible_to_first<Sequence, This>::value)
, make_indices_from_seq<Sequence>
>::type
>
dispatch(Sequence&&) BOOST_NOEXCEPT
{ return from_sequence<typename make_indices_from_seq<Sequence>::type>(); }
// forward_at_c allows to access Nth element even if ForwardSequence
// since fusion::at_c requires RandomAccessSequence.
namespace result_of
{
template <typename Sequence, int N>
struct forward_at_c
: fusion::result_of::deref<
typename fusion::result_of::advance_c<
typename fusion::result_of::begin<
typename remove_reference<Sequence>::type
>::type
, N
>::type
>
{};
}
template <int N, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::forward_at_c<Sequence, N>::type
forward_at_c(Sequence&& seq)
{
typedef typename
result_of::forward_at_c<Sequence, N>::type
result;
return std::forward<result>(*advance_c<N>(begin(seq)));
}
// Object proxy since preserve object order
template <std::size_t, typename T>
struct store
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store()
: elem() // value-initialized explicitly
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store(store const& rhs)
: elem(rhs.get())
{}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store&
operator=(store const& rhs)
{
elem = rhs.get();
return *this;
}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store(store&& rhs)
: elem(static_cast<T&&>(rhs.get()))
{}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store&
operator=(store&& rhs)
{
elem = static_cast<T&&>(rhs.get());
return *this;
}
template <typename U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
store(U&& rhs
, typename disable_if<is_same<typename pure<U>::type, store> >::type* = 0)
: elem(std::forward<U>(rhs))
{}
template <typename U>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename disable_if<is_same<typename pure<U>::type, store>, store&>::type
operator=(U&& rhs)
{
elem = std::forward<U>(rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
T & get() { return elem; }
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
T const& get() const { return elem; }
T elem;
};
template <typename I, typename ...T>
struct vector_data;
template <std::size_t ...I, typename ...T>
struct vector_data<detail::index_sequence<I...>, T...>
: store<I, T>...
, sequence_base<vector_data<detail::index_sequence<I...>, T...> >
{
typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef random_access_traversal_tag category;
typedef mpl::int_<sizeof...(T)> size;
typedef vector<T...> type_sequence;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector_data()
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector_data(copy_or_move, vector_data const& rhs)
: store<I, T>(static_cast<store<I, T> const&>(rhs))...
{}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector_data(copy_or_move, vector_data&& rhs)
: store<I, T>(std::forward<store<I, T> >(rhs))...
{}
template <typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit
vector_data(from_sequence<detail::index_sequence<I...> >, Sequence&& rhs)
: store<I, T>(forward_at_c<I>(rhs))...
{}
template <typename ...U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit
vector_data(each_elem, U&&... var)
: store<I, T>(std::forward<U>(var))...
{}
template <typename Sequence>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void
assign(Sequence&&, detail::index_sequence<>) {}
template <typename Sequence, std::size_t N, std::size_t ...M>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void
assign(Sequence&& seq, detail::index_sequence<N, M...>)
{
at_impl(mpl::int_<N>()) = vector_detail::forward_at_c<N>(seq);
assign(std::forward<Sequence>(seq), detail::index_sequence<M...>());
}
template <std::size_t N, typename U>
static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
auto at_detail(store<N, U>* this_) -> decltype(this_->get())
{
return this_->get();
}
template <std::size_t N, typename U>
static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
auto at_detail(store<N, U> const* this_) -> decltype(this_->get())
{
return this_->get();
}
template <typename J>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
auto at_impl(J) -> decltype(at_detail<J::value>(this))
{
return at_detail<J::value>(this);
}
template <typename J>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
auto at_impl(J) const -> decltype(at_detail<J::value>(this))
{
return at_detail<J::value>(this);
}
template <std::size_t N, typename U>
static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
U value_at_impl(store<N, U>*) { return boost::declval<U>(); }
};
template <typename V, typename... T>
struct trim_void_;
template <typename... T>
struct trim_void_<vector<T...> >
{
typedef vector_data<
typename detail::make_index_sequence<sizeof...(T)>::type
, T...
> type;
};
template <typename... T, typename... Tail>
struct trim_void_<vector<T...>, void_, Tail...>
: trim_void_<vector<T...> > {};
template <typename... T, typename Head, typename... Tail>
struct trim_void_<vector<T...>, Head, Tail...>
: trim_void_<vector<T..., Head>, Tail...> {};
template <typename... T>
struct trim_void : trim_void_<vector<>, T...> {};
} // namespace boost::fusion::vector_detail
// This class provides backward compatibility: vector<T, ..., void_, void_, ...>.
template <typename... T>
struct vector
: vector_detail::trim_void<T...>::type
{
typedef typename vector_detail::trim_void<T...>::type base;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector()
{}
// rvalue-references is required here in order to forward any arguments to
// base: vector(T const&...) doesn't work with trailing void_ and
// vector(U const&...) cannot forward any arguments to base.
template <typename... U>
// XXX: constexpr become error due to pull-request #79, booooo!!
// In the (near) future release, should be fixed.
/* BOOST_CONSTEXPR */ BOOST_FUSION_GPU_ENABLED
vector(U&&... u)
: base(vector_detail::dispatch<vector>(std::forward<U>(u)...), std::forward<U>(u)...)
{}
template <typename Sequence>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
vector&
operator=(Sequence&& rhs)
{
typedef typename
vector_detail::make_indices_from_seq<Sequence>::type
indices;
base::assign(std::forward<Sequence>(rhs), indices());
return *this;
}
};
}}
#endif #endif
#endif

View File

@ -9,11 +9,21 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector10.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector10.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#endif #endif
#endif

View File

@ -9,11 +9,21 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector20.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector20.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#endif #endif
#endif

View File

@ -9,11 +9,21 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector30.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector30.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#endif #endif
#endif

View File

@ -9,11 +9,21 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector40.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector40.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#endif #endif
#endif

View File

@ -9,11 +9,21 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector50.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector50.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#endif #endif
#endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,11 +9,35 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/vector_fwd.hpp> # include <boost/fusion/container/vector/detail/cpp03/vector_fwd.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
namespace boost { namespace fusion
{
template <typename ...T>
struct vector;
#define FUSION_VECTOR_N_ALIASES(z, N, d) \
template <typename ...T> \
using BOOST_PP_CAT(vector, N) = vector<T...>;
BOOST_PP_REPEAT(51, FUSION_VECTOR_N_ALIASES, ~)
#undef FUSION_VECTOR_N_ALIASES
}}
#endif #endif
#endif

View File

@ -9,16 +9,21 @@
#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED) #if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED)
# define BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED # define BOOST_FUSION_FUNCTIONAL_ADAPTER_LIMITS_HPP_INCLUDED
# include <boost/fusion/container/vector/detail/cpp03/limits.hpp> # include <boost/fusion/container/vector/detail/config.hpp>
# if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/limits.hpp>
# endif
# if !defined(BOOST_FUSION_UNFUSED_MAX_ARITY) # if !defined(BOOST_FUSION_UNFUSED_MAX_ARITY)
# define BOOST_FUSION_UNFUSED_MAX_ARITY 6 # define BOOST_FUSION_UNFUSED_MAX_ARITY 6
# elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # elif !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) && \
(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE)
# error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
# endif # endif
# if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) # if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY)
# define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6 # define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6
# elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # elif !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) && \
(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE)
# error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE"
# endif # endif

View File

@ -0,0 +1,29 @@
/*=============================================================================
Copyright (c) 2014-2015 Kohei Takahashi
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 FUSION_IS_SAME_SIZE_10082015_1156
#define FUSION_IS_SAME_SIZE_10082015_1156
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/equal_to.hpp>
namespace boost { namespace fusion { namespace detail
{
template <typename Sequence1, typename Sequence2, typename = void, typename = void>
struct is_same_size : mpl::false_ {};
template <typename Sequence1, typename Sequence2>
struct is_same_size<Sequence1, Sequence2,
typename enable_if<traits::is_sequence<Sequence1> >::type,
typename enable_if<traits::is_sequence<Sequence2> >::type>
: mpl::equal_to<result_of::size<Sequence1>, result_of::size<Sequence2> >
{};
}}}
#endif

View File

@ -1,53 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2014 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)
==============================================================================*/
#if !defined(FUSION_RESULT_OF_10272014_0654)
#define FUSION_RESULT_OF_10272014_0654
#include <boost/config.hpp>
#include <boost/utility/result_of.hpp>
#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF
#endif
#if !defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF)
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/has_xxx.hpp>
#endif
namespace boost { namespace fusion { namespace detail
{
// This is a temporary workaround for result_of before we make fusion fully
// sfinae result_of friendy, which will require some heavy lifting for some
// low level code. So far this is used only in the fold algorithm. This will
// be removed once we overhaul fold.
#if defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF)
template <typename Sig>
struct result_of_with_decltype : boost::tr1_result_of<Sig> {};
#else // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF)
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result)
template <typename Sig>
struct result_of_with_decltype;
template <typename F, typename... Args>
struct result_of_with_decltype<F(Args...)>
: mpl::if_<mpl::or_<has_result_type<F>, detail::has_result<F> >,
boost::tr1_result_of<F(Args...)>,
boost::detail::cpp0x_result_of<F(Args...)> >::type {};
#endif // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF)
}}}
#endif

View File

@ -11,11 +11,6 @@
#include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/detail/segmented_fold_until_impl.hpp> #include <boost/fusion/support/detail/segmented_fold_until_impl.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/container/list/cons.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {

View File

@ -13,7 +13,38 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# include <boost/fusion/tuple/detail/make_tuple.hpp> # include <boost/fusion/tuple/detail/make_tuple.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/tuple/tuple.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion
{
template <typename ...T>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline tuple<typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...>
make_tuple(T&&... arg)
{
typedef tuple<typename detail::as_fusion_element<
typename remove_const<
typename remove_reference<T>::type
>::type
>::type...> result_type;
return result_type(std::forward<T>(arg)...);
}
}}
#endif #endif
#endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -13,7 +13,80 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# include <boost/fusion/tuple/detail/tuple.hpp> # include <boost/fusion/tuple/detail/tuple.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/comparison.hpp>
#include <boost/fusion/sequence/io.hpp>
#include <utility>
namespace boost { namespace fusion
{
template <typename ...T>
struct tuple : vector<T...>
{
typedef vector<T...> base_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple()
: base_type() {}
template <typename ...U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple(tuple<U...> const& other)
: base_type(other) {}
template <typename ...U>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple(tuple<U...>&& other)
: base_type(std::move(other)) {}
template <typename ...U>
/*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED
explicit
tuple(U&&... args)
: base_type(std::forward<U>(args)...) {}
template <typename U>
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
tuple& operator=(U&& rhs)
{
base_type::operator=(std::forward<U>(rhs));
return *this;
}
};
template <typename Tuple>
struct tuple_size : result_of::size<Tuple> {};
template <int N, typename Tuple>
struct tuple_element : result_of::value_at_c<Tuple, N> {};
template <int N, typename Tuple>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::at_c<Tuple, N>::type
get(Tuple& tup)
{
return at_c<N>(tup);
}
template <int N, typename Tuple>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::at_c<Tuple const, N>::type
get(Tuple const& tup)
{
return at_c<N>(tup);
}
}}
#endif #endif
#endif

View File

@ -1,5 +1,5 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2014 Kohei Takahashi Copyright (c) 2014-2015 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,11 +9,35 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR) \
|| (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
# if defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# undef BOOST_FUSION_HAS_VARIADIC_TUPLE
# endif
#else
# if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# define BOOST_FUSION_HAS_VARIADIC_TUPLE
# endif
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# include <boost/fusion/tuple/detail/tuple_fwd.hpp> # include <boost/fusion/tuple/detail/tuple_fwd.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace fusion
{
template <typename ...T>
struct tuple;
}}
#endif #endif
#endif

View File

@ -13,7 +13,26 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// With no variadics, we will use the C++03 version // With no variadics, we will use the C++03 version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
# include <boost/fusion/tuple/detail/tuple_tie.hpp> # include <boost/fusion/tuple/detail/tuple_tie.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/tuple/tuple.hpp>
namespace boost { namespace fusion
{
template <typename ...T>
BOOST_FUSION_GPU_ENABLED
inline tuple<T&...>
tie(T&... arg)
{
return tuple<T&...>(arg...);
}
}}
#endif #endif
#endif

View File

@ -17,6 +17,9 @@
#include <boost/fusion/algorithm/iteration/fold.hpp> #include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/type_traits/declval.hpp>
#endif
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -61,7 +64,10 @@ namespace boost { namespace fusion
template<typename StrictestSoFar, typename Next> template<typename StrictestSoFar, typename Next>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type
operator()(StrictestSoFar&&, Next&&) const; operator()(StrictestSoFar&&, Next&&) const
{
return boost::declval<typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type>();
}
#endif #endif
}; };

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#ifndef BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED #ifndef BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED
#define BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED #define BOOST_FUSION_SEQUENCE_FLATTEN_VIEW_HPP_INCLUDED

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#ifndef BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED #ifndef BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED
#define BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED #define BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#ifndef BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED #ifndef BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED
#define BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED #define BOOST_FUSION_FLATTEN_VIEW_ITERATOR_HPP_INCLUDED

View File

@ -9,7 +9,6 @@
#define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM #define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/fusion/iterator/advance.hpp> #include <boost/fusion/iterator/advance.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
@ -30,11 +29,11 @@ namespace boost { namespace fusion
template<typename Iterator, typename Dist> template<typename Iterator, typename Dist>
struct apply struct apply
{ {
typedef typename Iterator::first_type::iterator_type iterator_type; typedef typename Iterator::first_type iterator_type;
typedef typename Iterator::sequence_type sequence_type; typedef typename Iterator::sequence_type sequence_type;
typedef nview_iterator<sequence_type, typedef nview_iterator<sequence_type,
typename mpl::advance<iterator_type, Dist>::type> type; typename result_of::advance<iterator_type, Dist>::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type static type

View File

@ -10,6 +10,7 @@
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -29,7 +30,7 @@ namespace boost { namespace fusion
typedef typename Sequence::sequence_type sequence_type; typedef typename Sequence::sequence_type sequence_type;
typedef typename Sequence::index_type index_type; typedef typename Sequence::index_type index_type;
typedef typename result_of::at<index_type, N>::type index; typedef typename result_of::value_at<index_type, N>::type index;
typedef typename result_of::at<sequence_type, index>::type type; typedef typename result_of::at<sequence_type, index>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED

View File

@ -9,7 +9,6 @@
#define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM #define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
@ -33,7 +32,7 @@ namespace boost { namespace fusion
typedef typename Sequence::index_type index_type; typedef typename Sequence::index_type index_type;
typedef nview_iterator<Sequence, typedef nview_iterator<Sequence,
typename mpl::begin<index_type>::type> type; typename result_of::begin<index_type>::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& s) static type call(Sequence& s)

View File

@ -17,10 +17,13 @@
#include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#define BOOST_PP_ITERATION_PARAMS_1 \ #define BOOST_PP_ITERATION_PARAMS_1 \
(3, (1, FUSION_MAX_VECTOR_SIZE, \ (3, (1, FUSION_MAX_VECTOR_SIZE, \
"boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \ "boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \
/**/ /**/
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -9,8 +9,8 @@
#define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM #define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -30,7 +30,7 @@ namespace boost { namespace fusion
typedef typename Iterator::first_type first_type; typedef typename Iterator::first_type first_type;
typedef typename Iterator::sequence_type sequence_type; typedef typename Iterator::sequence_type sequence_type;
typedef typename result_of::deref<first_type>::type index; typedef typename result_of::value_of<first_type>::type index;
typedef typename result_of::at< typedef typename result_of::at<
typename sequence_type::sequence_type, index>::type type; typename sequence_type::sequence_type, index>::type type;

View File

@ -9,7 +9,6 @@
#define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM #define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/end.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
@ -34,7 +33,7 @@ namespace boost { namespace fusion
typedef typename Sequence::index_type index_type; typedef typename Sequence::index_type index_type;
typedef nview_iterator<Sequence, typedef nview_iterator<Sequence,
typename mpl::end<index_type>::type> type; typename result_of::end<index_type>::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& s) static type call(Sequence& s)

View File

@ -9,7 +9,7 @@
#define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM #define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/next.hpp> #include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -29,11 +29,11 @@ namespace boost { namespace fusion
template <typename Iterator> template <typename Iterator>
struct apply struct apply
{ {
typedef typename Iterator::first_type::iterator_type first_type; typedef typename Iterator::first_type first_type;
typedef typename Iterator::sequence_type sequence_type; typedef typename Iterator::sequence_type sequence_type;
typedef nview_iterator<sequence_type, typedef nview_iterator<sequence_type,
typename mpl::next<first_type>::type> type; typename result_of::next<first_type>::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type static type

View File

@ -8,11 +8,43 @@
#define BOOST_FUSION_NVIEW_IMPL_17122014_1948 #define BOOST_FUSION_NVIEW_IMPL_17122014_1948
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version // Without variadics, we will use the PP version
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/view/nview/detail/cpp03/nview_impl.hpp> # include <boost/fusion/view/nview/detail/cpp03/nview_impl.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, int ...I>
struct as_nview
{
typedef vector<mpl::int_<I>...> index_type;
typedef nview<Sequence, index_type> type;
};
}
template <int ...I, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline nview<Sequence, vector<mpl::int_<I>...> >
as_nview(Sequence& s)
{
typedef vector<mpl::int_<I>...> index_type;
return nview<Sequence, index_type>(s);
}
}}
#endif #endif
#endif

View File

@ -9,7 +9,7 @@
#define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM #define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/prior.hpp> #include <boost/fusion/iterator/prior.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -29,11 +29,11 @@ namespace boost { namespace fusion
template <typename Iterator> template <typename Iterator>
struct apply struct apply
{ {
typedef typename Iterator::first_type::iterator_type first_type; typedef typename Iterator::first_type first_type;
typedef typename Iterator::sequence_type sequence_type; typedef typename Iterator::sequence_type sequence_type;
typedef nview_iterator<sequence_type, typedef nview_iterator<sequence_type,
typename mpl::prior<first_type>::type> type; typename result_of::prior<first_type>::type> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type static type

View File

@ -9,19 +9,15 @@
#define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM #define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/add_reference.hpp> #include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp> #include <boost/type_traits/add_const.hpp>
#include <boost/fusion/support/is_view.hpp> #include <boost/fusion/support/is_view.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/sequence_base.hpp> #include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/view/transform_view.hpp> #include <boost/fusion/view/transform_view.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
@ -99,7 +95,7 @@ namespace boost { namespace fusion
typedef mpl::true_ is_view; typedef mpl::true_ is_view;
typedef Indicies index_type; typedef Indicies index_type;
typedef typename mpl::size<Indicies>::type size; typedef typename result_of::size<Indicies>::type size;
typedef typename mpl::if_< typedef typename mpl::if_<
is_const<Sequence>, detail::addconstref, detail::addref is_const<Sequence>, detail::addconstref, detail::addref

View File

@ -12,7 +12,6 @@
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/fusion/view/nview/detail/size_impl.hpp> #include <boost/fusion/view/nview/detail/size_impl.hpp>
#include <boost/fusion/view/nview/detail/begin_impl.hpp> #include <boost/fusion/view/nview/detail/begin_impl.hpp>
@ -40,7 +39,7 @@ namespace boost { namespace fusion
typedef random_access_traversal_tag category; typedef random_access_traversal_tag category;
typedef Sequence sequence_type; typedef Sequence sequence_type;
typedef mpl_iterator<Pos> first_type; typedef Pos first_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit nview_iterator(Sequence& in_seq) explicit nview_iterator(Sequence& in_seq)

View File

@ -65,6 +65,12 @@ project
[ run sequence/boost_tuple.cpp : : : : ] [ run sequence/boost_tuple.cpp : : : : ]
[ run sequence/boost_tuple_iterator.cpp : : : : ] [ run sequence/boost_tuple_iterator.cpp : : : : ]
[ run sequence/cons.cpp : : : : ] [ run sequence/cons.cpp : : : : ]
[ run sequence/convert_boost_tuple.cpp : : : : ]
[ run sequence/convert_deque.cpp : : : : ]
[ run sequence/convert_list.cpp : : : : ]
[ run sequence/convert_std_pair.cpp : : : : ]
[ run sequence/convert_std_tuple.cpp : : : : ]
[ run sequence/convert_vector.cpp : : : : ]
[ run sequence/filter_view.cpp : : : : ] [ run sequence/filter_view.cpp : : : : ]
[ run sequence/hash.cpp : : : : ] [ run sequence/hash.cpp : : : : ]
[ run sequence/io.cpp : : : : ] [ run sequence/io.cpp : : : : ]
@ -86,6 +92,7 @@ project
[ run sequence/deque_copy.cpp : : : : ] [ run sequence/deque_copy.cpp : : : : ]
[ run sequence/deque_iterator.cpp : : : : ] [ run sequence/deque_iterator.cpp : : : : ]
[ run sequence/deque_hash.cpp : : : : ] [ run sequence/deque_hash.cpp : : : : ]
[ compile sequence/deque_is_constructible.cpp : : : : ]
[ run sequence/deque_make.cpp : : : : ] [ run sequence/deque_make.cpp : : : : ]
[ run sequence/deque_misc.cpp : : : : ] [ run sequence/deque_misc.cpp : : : : ]
[ run sequence/deque_move.cpp : : : : ] [ run sequence/deque_move.cpp : : : : ]

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp> #include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/sequence/io/out.hpp> #include <boost/fusion/sequence/io/out.hpp>

View File

@ -238,7 +238,7 @@ main()
} }
{ {
#if !defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) #if defined(BOOST_RESULT_OF_USE_DECLTYPE)
{ {
boost::fusion::vector<int, double, long> container{1, 2, 3}; boost::fusion::vector<int, double, long> container{1, 2, 3};
functor f; functor f;

View File

@ -189,7 +189,7 @@ struct fold_test_n
>::type >::type
, typename mpl::if_c< , typename mpl::if_c<
!n !n
, mpl::vector<mpl::int_<1>, mpl::int_<0> > const& , mpl::vector<mpl::int_<1>, mpl::int_<0> >&
, mpl::vector<mpl::int_<n+1>, mpl::int_<squares_sum> > , mpl::vector<mpl::int_<n+1>, mpl::int_<squares_sum> >
>::type >::type
> >

View File

@ -88,6 +88,7 @@ main()
auto i1 = find<int>(popv); auto i1 = find<int>(popv);
auto i2 = find<double>(pop); auto i2 = find<double>(pop);
(void)push;
BOOST_TEST(i1 != end(pop)); BOOST_TEST(i1 != end(pop));
BOOST_TEST(i2 != end(pop)); BOOST_TEST(i2 != end(pop));
BOOST_TEST(i1 != i2); BOOST_TEST(i1 != i2);

View File

@ -12,9 +12,9 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/fusion/support/detail/result_of.hpp> #include <boost/utility/result_of.hpp>
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) #if !defined(BOOST_NO_SFINAE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>

51
test/sequence/convert.hpp Normal file
View File

@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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 <string>
#include <boost/config.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/fusion/include/convert.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/deque.hpp>
#include <boost/fusion/include/list.hpp>
#include <boost/fusion/include/boost_tuple.hpp>
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/fusion/include/std_tuple.hpp>
#endif
template <typename Tag>
void test(FUSION_SEQUENCE<int, std::string> const& seq)
{
typedef typename
boost::fusion::result_of::convert<
Tag
, FUSION_SEQUENCE<int, std::string>
>::type
type;
type v = boost::fusion::convert<Tag>(seq);
BOOST_TEST((boost::fusion::at_c<0>(v) == 123));
BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!"));
}
int main()
{
FUSION_SEQUENCE<int, std::string> seq(123, "Hola!!!");
test<boost::fusion::vector_tag>(seq);
test<boost::fusion::deque_tag>(seq);
test<boost::fusion::cons_tag>(seq);
test<boost::fusion::boost_tuple_tag>(seq);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
test<boost::fusion::std_tuple_tag>(seq);
#endif
return boost::report_errors();
}

View File

@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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/tuple/tuple.hpp>
#include <boost/fusion/include/boost_tuple.hpp>
#define FUSION_SEQUENCE boost::tuples::tuple
#include "convert.hpp"

View File

@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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/fusion/include/deque.hpp>
#define FUSION_SEQUENCE boost::fusion::deque
#include "convert.hpp"

View File

@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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/fusion/include/list.hpp>
#define FUSION_SEQUENCE boost::fusion::list
#include "convert.hpp"

View File

@ -0,0 +1,14 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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 <utility>
#include <boost/fusion/include/std_pair.hpp>
#define FUSION_SEQUENCE std::pair
#include "convert.hpp"

View File

@ -0,0 +1,25 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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_CXX11_VARIADIC_TEMPLATES)
#include <tuple>
#include <boost/fusion/include/std_tuple.hpp>
#define FUSION_SEQUENCE std::tuple
#include "convert.hpp"
#else
int main()
{
}
#endif

View File

@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2015 Kohei Takahashi
Use modification and distribution are subject to 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/fusion/include/vector.hpp>
#define FUSION_SEQUENCE boost::fusion::vector
#include "convert.hpp"

View File

@ -0,0 +1,21 @@
/*=============================================================================
Copyright (c) 2015 Louis Dionne
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>
#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS
#include <type_traits>
#include <boost/fusion/include/deque.hpp>
struct Dummy { };
// Make sure deque's constructor is SFINAE-friendly.
static_assert(!std::is_constructible<boost::fusion::deque<int>, Dummy const&>::value, "");
#endif

View File

@ -1,9 +1,9 @@
/*////////////////////////////////////////////////////////////////////////////// /*==============================================================================
Copyright (c) 2013 Jamboree Copyright (c) 2013 Jamboree
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////*/ ==============================================================================*/
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp> #include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/view/flatten_view/flatten_view.hpp> #include <boost/fusion/view/flatten_view/flatten_view.hpp>