/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2006 Dan Marsden Copyright (c) 2009-2010 Christopher Schmidt Copyright (c) 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) ==============================================================================*/ #include #define FUSION_HASH # #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::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::type # define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) fusion::deref(IT) #endif #if (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500) FUSION_HASH define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void FUSION_HASH else FUSION_HASH define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type FUSION_HASH endif #else # if BOOST_WORKAROUND(BOOST_MSVC, < 1500) # define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void # else # define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type # endif #endif namespace boost { namespace fusion { namespace detail { template struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME) {}; template struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<0,It,State,F , typename boost::enable_if_has_type::type #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500) #endif #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \ (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) , true #endif #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH endif #endif > { typedef typename State::type type; }; template struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)= 1500) #endif #if BOOST_WORKAROUND(BOOST_MSVC, >= 1500) || \ (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) // Following SFINAE enables to avoid MSVC 9's partial specialization // ambiguous bug but MSVC 8 don't compile, and moreover MSVC 8 style // workaround won't work with MSVC 9. typename boost::disable_if_c::type::type #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH else BOOST_FUSION_FOLD_IMPL_ENABLER(State) #endif #else BOOST_FUSION_FOLD_IMPL_ENABLER(State) #endif #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH endif #endif >::type #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500) #endif #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \ (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)) , false #endif #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) FUSION_HASH endif #endif > : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)< SeqSize-1 , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION::type , boost::result_of< F( typename add_reference::type, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const) ) > , F > {}; template 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 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_, 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::type , boost::result_of< F( typename add_reference::type, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const) ) > , F >( mpl::int_() , fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it) , f(state, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it)) , f ); } template::value , bool = traits::is_segmented::value> struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME) {}; template struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME) : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)< result_of::size::value , BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM( typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION::type ) , add_reference , F > {}; template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)::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::type ) , add_reference , F >( typename result_of::size::type() , BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM( fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq) ) , state , f ); } } namespace result_of { template struct BOOST_FUSION_FOLD_NAME : detail::BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME) {}; } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 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 detail::BOOST_FUSION_FOLD_NAME(seq, state, f); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 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 detail::BOOST_FUSION_FOLD_NAME(seq, state, f); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq , State , F >::type BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f) { return detail::BOOST_FUSION_FOLD_NAME(seq, state, f); } template BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED inline typename result_of::BOOST_FUSION_FOLD_NAME< Seq const , State , F >::type BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f) { return detail::BOOST_FUSION_FOLD_NAME(seq, state, f); } }} #undef BOOST_FUSION_FOLD_NAME #undef BOOST_FUSION_FOLD_IMPL_ENABLER #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 #undef FUSION_HASH