diff options
Diffstat (limited to '3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail')
6 files changed, 1468 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/fold.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/fold.hpp new file mode 100644 index 0000000..174c4b1 --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -0,0 +1,462 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2006 Dan Marsden + Copyright (c) 2009-2010 Christopher Schmidt + + 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/preprocessor/cat.hpp> + +#ifdef BOOST_FUSION_REVERSE_FOLD +# ifdef BOOST_FUSION_ITER_FOLD +# define BOOST_FUSION_FOLD_NAME reverse_iter_fold +# else +# define BOOST_FUSION_FOLD_NAME reverse_fold +# endif + +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION end +# define BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION prior +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(IT) \ + typename fusion::result_of::prior<IT>::type +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(IT) fusion::prior(IT) +#else +# ifdef BOOST_FUSION_ITER_FOLD +# define BOOST_FUSION_FOLD_NAME iter_fold +# else +# define BOOST_FUSION_FOLD_NAME fold +# endif + +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION begin +# define BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION next +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(IT) IT +# define BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(IT) IT +#endif +#ifdef BOOST_FUSION_ITER_FOLD +# define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(IT) IT& +# define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) IT +#else +# define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(IT) \ + typename fusion::result_of::deref<IT>::type +# define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) fusion::deref(IT) +#endif + +namespace boost { namespace fusion +{ + namespace detail + { + template<typename State, typename It, typename F> + struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state) + : boost::result_of< + F( + typename add_reference<typename add_const<State>::type>::type, + BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It)) + > + {}; + + template<typename Result,int N> + struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME) + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< + It0 const + >::type + It1; + It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0); + typedef typename + result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< + It1 + >::type + It2; + It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1); + typedef typename + result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< + It2 + >::type + It3; + It3 it3 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State1,It1,F>::type State2; + State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State2,It2,F>::type State3; + State3 const state3=f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); + + 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 Result> + struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,3> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< + It0 const + >::type + It1; + It1 it1 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0); + typedef typename + result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION< + It1 + >::type + It2; + It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State1,It1,F>::type State2; + State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + + return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); + } + }; + + template<typename Result> + struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,2> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)<State,It0,F>::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + + return f( + state1, + BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( + fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0))); + } + }; + + template<typename Result> + struct BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)<Result,1> + { + template<typename State, typename It0, typename F> + 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> + static Result + call(State const& state,It0 const& it0, 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 boost::result_of< + 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; + + 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; + + 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 + > + {}; + } + + namespace result_of + { + template<typename Seq, typename State, typename F> + struct BOOST_FUSION_FOLD_NAME + : detail::BOOST_PP_CAT(result_of_, BOOST_FUSION_FOLD_NAME)< + Seq + , State + , F + , traits::is_segmented<Seq>::type::value + > + {}; + } + + template<typename Seq, typename State, typename F> + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq& seq, State const& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME<Seq,State const,F>::call( + state, + seq, + f); + } + + template<typename Seq, typename State, typename F> + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq const + , State const + , F + >::type + 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( + state, + seq, + f); + } + + template<typename Seq, typename State, typename F> + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME<Seq,State,F>::call( + state, + seq, + f); + } + + template<typename Seq, typename State, typename F> + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq const + , State const + , F + >::type + BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f) + { + return result_of::BOOST_FUSION_FOLD_NAME<Seq const,State,F>::call( + state, + seq, + f); + } +}} + +#undef BOOST_FUSION_FOLD_NAME +#undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION +#undef BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION +#undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM +#undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM +#undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM +#undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/for_each.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/for_each.hpp new file mode 100644 index 0000000..66a1935 --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/for_each.hpp @@ -0,0 +1,138 @@ +/*============================================================================= + Copyright (c) 2001-2011 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_FOR_EACH_05052005_1028) +#define FUSION_FOR_EACH_05052005_1028 + +#include <boost/fusion/sequence/intrinsic/begin.hpp> +#include <boost/fusion/sequence/intrinsic/end.hpp> +#include <boost/fusion/iterator/equal_to.hpp> +#include <boost/fusion/iterator/next.hpp> +#include <boost/fusion/iterator/deref.hpp> +#include <boost/fusion/iterator/distance.hpp> +#include <boost/fusion/support/category_of.hpp> +#include <boost/mpl/bool.hpp> + +namespace boost { namespace fusion { +namespace detail +{ + template <typename First, typename Last, typename F> + inline void + for_each_linear(First const&, Last const&, F const&, mpl::true_) + { + } + + template <typename First, typename Last, typename F> + inline void + for_each_linear(First const& first, Last const& last, F const& f, mpl::false_) + { + f(*first); + detail::for_each_linear(fusion::next(first), last, f, + result_of::equal_to<typename result_of::next<First>::type, Last>()); + } + + + template <typename Sequence, typename F, typename Tag> + inline void + for_each_dispatch(Sequence& seq, F const& f, Tag) + { + detail::for_each_linear( + fusion::begin(seq) + , fusion::end(seq) + , f + , result_of::equal_to< + typename result_of::begin<Sequence>::type + , typename result_of::end<Sequence>::type>()); + } + + template<int N> + struct for_each_unrolled + { + template<typename I0, typename F> + static void call(I0 const& i0, F const& f) + { + f(*i0); + typedef typename result_of::next<I0>::type I1; + I1 i1(fusion::next(i0)); + f(*i1); + typedef typename result_of::next<I1>::type I2; + I2 i2(fusion::next(i1)); + f(*i2); + typedef typename result_of::next<I2>::type I3; + I3 i3(fusion::next(i2)); + f(*i3); + for_each_unrolled<N-4>::call(fusion::next(i3), f); + } + }; + + template<> + struct for_each_unrolled<3> + { + template<typename I0, typename F> + static void call(I0 const& i0, F const& f) + { + f(*i0); + typedef typename result_of::next<I0>::type I1; + I1 i1(fusion::next(i0)); + f(*i1); + typedef typename result_of::next<I1>::type I2; + I2 i2(fusion::next(i1)); + f(*i2); + } + }; + + template<> + struct for_each_unrolled<2> + { + template<typename I0, typename F> + static void call(I0 const& i0, F const& f) + { + f(*i0); + typedef typename result_of::next<I0>::type I1; + I1 i1(fusion::next(i0)); + f(*i1); + } + }; + + template<> + struct for_each_unrolled<1> + { + template<typename I0, typename F> + static void call(I0 const& i0, F const& f) + { + f(*i0); + } + }; + + template<> + struct for_each_unrolled<0> + { + template<typename It, typename F> + static void call(It const&, F const&) + { + } + }; + + template <typename Sequence, typename F> + inline void + for_each_dispatch(Sequence& seq, F const& f, random_access_traversal_tag) + { + typedef typename result_of::begin<Sequence>::type begin; + typedef typename result_of::end<Sequence>::type end; + for_each_unrolled<result_of::distance<begin, end>::type::value>::call(fusion::begin(seq), f); + } + + template <typename Sequence, typename F> + inline void + for_each(Sequence& seq, F const& f, mpl::false_) // unsegmented implementation + { + detail::for_each_dispatch(seq, f, typename traits::category_of<Sequence>::type()); + } +}}} + + +#endif + diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp new file mode 100644 index 0000000..c89a7dd --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp @@ -0,0 +1,381 @@ +/*============================================================================= + Copyright (c) 2001-2011 Joel de Guzman + Copyright (c) 2007 Dan Marsden + Copyright (c) 2009-2010 Christopher Schmidt + + 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) + + This is an auto-generated file. Do not edit! +==============================================================================*/ +namespace boost { namespace fusion +{ + namespace detail + { + template<typename State, typename It, typename F> + struct fold_lvalue_state + : boost::result_of< + F( + typename add_reference<typename add_const<State>::type>::type, + typename fusion::result_of::deref<It>::type) + > + {}; + template<typename Result,int N> + struct unrolled_fold + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::next< + It0 const + >::type + It1; + It1 it1 = fusion::next(it0); + typedef typename + result_of::next< + It1 + >::type + It2; + It2 it2 = fusion::next(it1); + typedef typename + result_of::next< + It2 + >::type + It3; + It3 it3 = fusion::next(it2); + typedef typename fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + typedef typename fold_lvalue_state<State1,It1,F>::type State2; + State2 const state2=f(state1,fusion::deref(it1)); + typedef typename fold_lvalue_state<State2,It2,F>::type State3; + State3 const state3=f(state2,fusion::deref(it2)); + return unrolled_fold< + Result + , N-4 + >::call( + f(state3,fusion::deref(it3)), + fusion::next(it3), + f); + } + }; + template<typename Result> + struct unrolled_fold<Result,3> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::next< + It0 const + >::type + It1; + It1 it1 = fusion::next(it0); + typedef typename + result_of::next< + It1 + >::type + It2; + It2 it2 = fusion::next(it1); + typedef typename fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + typedef typename fold_lvalue_state<State1,It1,F>::type State2; + State2 const state2=f(state1,fusion::deref(it1)); + return f(state2,fusion::deref(it2)); + } + }; + template<typename Result> + struct unrolled_fold<Result,2> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + return f( + state1, + fusion::deref( fusion::next(it0))); + } + }; + template<typename Result> + struct unrolled_fold<Result,1> + { + template<typename State, typename It0, typename F> + 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> + 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 + > + {}; + template<typename StateRef, typename It0, typename F> + struct result_of_unrolled_fold< + StateRef + , It0 + , F + , 1 + > + : fold_lvalue_state< + StateRef + , It0 const + , F + > + {}; + template<typename StateRef, typename It0, typename F> + struct result_of_unrolled_fold< + StateRef + , It0 + , F + , 0 + > + { + typedef StateRef type; + }; + template<typename StateRef, typename It0, typename F, int SeqSize> + struct result_of_first_unrolledfold + { + typedef typename + result_of_unrolled_fold< + typename boost::result_of< + F( + StateRef, + typename fusion::result_of::deref< It0 const>::type + ) + >::type + , typename result_of::next< + It0 const + >::type + , F + , SeqSize-1 + >::type + 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; + 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; + 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 + : fold_impl< + result_of::size<Seq>::value + , typename add_reference< + typename add_const<State>::type + >::type + , Seq + , F + > + {}; + } + namespace result_of + { + template<typename Seq, typename State, typename F> + struct fold + : detail::result_of_fold< + Seq + , State + , F + , traits::is_segmented<Seq>::type::value + > + {}; + } + template<typename Seq, typename State, typename F> + inline typename result_of::fold< + Seq + , State const + , F + >::type + fold(Seq& seq, State const& state, F f) + { + return result_of::fold<Seq,State const,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::fold< + Seq const + , State const + , F + >::type + fold(Seq const& seq, State const& state, F f) + { + return result_of::fold<Seq const,State const,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::fold< + Seq + , State const + , F + >::type + fold(Seq& seq, State& state, F f) + { + return result_of::fold<Seq,State,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::fold< + Seq const + , State const + , F + >::type + fold(Seq const& seq, State& state, F f) + { + return result_of::fold<Seq const,State,F>::call( + state, + seq, + f); + } +}} diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp new file mode 100644 index 0000000..48a4134 --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/preprocessed/reverse_fold.hpp @@ -0,0 +1,380 @@ +/*============================================================================= + Copyright (c) 2009-2010 Christopher Schmidt + Copyright (c) 2001-2011 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) + + This is an auto-generated file. Do not edit! +==============================================================================*/ +namespace boost { namespace fusion +{ + namespace detail + { + template<typename State, typename It, typename F> + struct reverse_fold_lvalue_state + : boost::result_of< + F( + typename add_reference<typename add_const<State>::type>::type, + typename fusion::result_of::deref<It>::type) + > + {}; + template<typename Result,int N> + struct unrolled_reverse_fold + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::prior< + It0 const + >::type + It1; + It1 it1 = fusion::prior(it0); + typedef typename + result_of::prior< + It1 + >::type + It2; + It2 it2 = fusion::prior(it1); + typedef typename + result_of::prior< + It2 + >::type + It3; + It3 it3 = fusion::prior(it2); + typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + typedef typename reverse_fold_lvalue_state<State1,It1,F>::type State2; + State2 const state2=f(state1,fusion::deref(it1)); + typedef typename reverse_fold_lvalue_state<State2,It2,F>::type State3; + State3 const state3=f(state2,fusion::deref(it2)); + return unrolled_reverse_fold< + Result + , N-4 + >::call( + f(state3,fusion::deref(it3)), + fusion::prior(it3), + f); + } + }; + template<typename Result> + struct unrolled_reverse_fold<Result,3> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename + result_of::prior< + It0 const + >::type + It1; + It1 it1 = fusion::prior(it0); + typedef typename + result_of::prior< + It1 + >::type + It2; + It2 it2 = fusion::prior(it1); + typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + typedef typename reverse_fold_lvalue_state<State1,It1,F>::type State2; + State2 const state2=f(state1,fusion::deref(it1)); + return f(state2,fusion::deref(it2)); + } + }; + template<typename Result> + struct unrolled_reverse_fold<Result,2> + { + template<typename State, typename It0, typename F> + static Result + call(State const& state,It0 const& it0,F f) + { + typedef typename reverse_fold_lvalue_state<State,It0,F>::type State1; + State1 const state1=f(state,fusion::deref(it0)); + return f( + state1, + fusion::deref( fusion::prior(it0))); + } + }; + template<typename Result> + struct unrolled_reverse_fold<Result,1> + { + template<typename State, typename It0, typename F> + 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> + 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 + > + {}; + template<typename StateRef, typename It0, typename F> + struct result_of_unrolled_reverse_fold< + StateRef + , It0 + , F + , 1 + > + : reverse_fold_lvalue_state< + StateRef + , It0 const + , F + > + {}; + template<typename StateRef, typename It0, typename F> + struct result_of_unrolled_reverse_fold< + StateRef + , It0 + , F + , 0 + > + { + typedef StateRef type; + }; + template<typename StateRef, typename It0, typename F, int SeqSize> + struct result_of_first_unrolledreverse_fold + { + typedef typename + result_of_unrolled_reverse_fold< + typename boost::result_of< + F( + StateRef, + typename fusion::result_of::deref< It0 const>::type + ) + >::type + , typename result_of::prior< + It0 const + >::type + , F + , SeqSize-1 + >::type + 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; + 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; + 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 + : reverse_fold_impl< + result_of::size<Seq>::value + , typename add_reference< + typename add_const<State>::type + >::type + , Seq + , F + > + {}; + } + namespace result_of + { + template<typename Seq, typename State, typename F> + struct reverse_fold + : detail::result_of_reverse_fold< + Seq + , State + , F + , traits::is_segmented<Seq>::type::value + > + {}; + } + template<typename Seq, typename State, typename F> + inline typename result_of::reverse_fold< + Seq + , State const + , F + >::type + reverse_fold(Seq& seq, State const& state, F f) + { + return result_of::reverse_fold<Seq,State const,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::reverse_fold< + Seq const + , State const + , F + >::type + reverse_fold(Seq const& seq, State const& state, F f) + { + return result_of::reverse_fold<Seq const,State const,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::reverse_fold< + Seq + , State const + , F + >::type + reverse_fold(Seq& seq, State& state, F f) + { + return result_of::reverse_fold<Seq,State,F>::call( + state, + seq, + f); + } + template<typename Seq, typename State, typename F> + inline typename result_of::reverse_fold< + Seq const + , State const + , F + >::type + reverse_fold(Seq const& seq, State& state, F f) + { + return result_of::reverse_fold<Seq const,State,F>::call( + state, + seq, + f); + } +}} diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp new file mode 100644 index 0000000..2371e18 --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_fold.hpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_FOLD_S_HPP_INCLUDED) +#define BOOST_FUSION_FOLD_S_HPP_INCLUDED + +#include <boost/fusion/algorithm/iteration/fold_fwd.hpp> +#include <boost/fusion/support/segmented_fold_until.hpp> + +namespace boost { namespace fusion { namespace detail +{ + template <typename Fun> + struct segmented_fold_fun + { + explicit segmented_fold_fun(Fun const& f) + : fun(f) + {} + + Fun const& fun; + + template <typename Sequence, typename State, typename Context> + struct apply + { + typedef typename result_of::fold<Sequence, State, Fun>::type type; + typedef mpl::true_ continue_type; + + static type call(Sequence& seq, State const& state, Context const&, segmented_fold_fun const& fun) + { + return fusion::fold(seq, state, fun.fun); + } + }; + }; + + // The default implementation of this lives in detail/fold.hpp + template <typename Sequence, typename State, typename Fun, bool IsSegmented> + struct result_of_fold; + + template <typename Sequence, typename State, typename Fun> + struct result_of_fold<Sequence, State, Fun, true> + { + typedef + typename result_of::segmented_fold_until< + Sequence, + State, + segmented_fold_fun<Fun> + >::type + type; + + static type call(State& state, Sequence& seq, Fun fun) + { + return fusion::segmented_fold_until(seq, state, segmented_fold_fun<Fun>(fun)); + } + }; +}}} + +#endif diff --git a/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp new file mode 100644 index 0000000..f7ffb24 --- /dev/null +++ b/3rdParty/Boost/src/boost/fusion/algorithm/iteration/detail/segmented_for_each.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2011 Eric Niebler + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_SEGMENTED_FOR_EACH_HPP_INCLUDED) +#define BOOST_FUSION_SEGMENTED_FOR_EACH_HPP_INCLUDED + +#include <boost/mpl/bool.hpp> +#include <boost/fusion/support/void.hpp> +#include <boost/fusion/algorithm/iteration/for_each_fwd.hpp> +#include <boost/fusion/support/segmented_fold_until.hpp> + +namespace boost { namespace fusion { namespace detail +{ + template <typename Fun> + struct segmented_for_each_fun + { + explicit segmented_for_each_fun(Fun const& f) + : fun(f) + {} + + Fun const& fun; + + template <typename Sequence, typename State, typename Context> + struct apply + { + typedef void_ type; + typedef mpl::true_ continue_type; + + static type call(Sequence& seq, State const&, Context const&, segmented_for_each_fun const& fun) + { + fusion::for_each(seq, fun.fun); + return void_(); + } + }; + }; + + template <typename Sequence, typename F> + inline void + for_each(Sequence& seq, F const& f, mpl::true_) // segmented implementation + { + fusion::segmented_fold_until(seq, void_(), segmented_for_each_fun<F>(f)); + } +}}} + +#endif |