Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:31:09

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003     Copyright (c) 2006 Dan Marsden
0004     Copyright (c) 2009-2010 Christopher Schmidt
0005     Copyright (c) 2015 Kohei Takahashi
0006 
0007     Distributed under the Boost Software License, Version 1.0. (See accompanying
0008     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 ==============================================================================*/
0010 #include <boost/preprocessor/cat.hpp>
0011 
0012 #define FUSION_HASH #
0013 
0014 #ifdef BOOST_FUSION_REVERSE_FOLD
0015 #   ifdef BOOST_FUSION_ITER_FOLD
0016 #       define BOOST_FUSION_FOLD_NAME reverse_iter_fold
0017 #   else
0018 #       define BOOST_FUSION_FOLD_NAME reverse_fold
0019 #   endif
0020 
0021 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION end
0022 #   define BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION prior
0023 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(IT)                   \
0024         typename fusion::result_of::prior<IT>::type
0025 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(IT) fusion::prior(IT)
0026 #else
0027 #   ifdef BOOST_FUSION_ITER_FOLD
0028 #       define BOOST_FUSION_FOLD_NAME iter_fold
0029 #   else
0030 #       define BOOST_FUSION_FOLD_NAME fold
0031 #   endif
0032 
0033 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION begin
0034 #   define BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION next
0035 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(IT) IT
0036 #   define BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(IT) IT
0037 #endif
0038 #ifdef BOOST_FUSION_ITER_FOLD
0039 #   define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(IT) IT&
0040 #   define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) IT
0041 #else
0042 #   define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(IT)                  \
0043         typename fusion::result_of::deref<IT>::type
0044 #   define BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(IT) fusion::deref(IT)
0045 #endif
0046 
0047 #if (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0048 FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
0049 FUSION_HASH     define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
0050 FUSION_HASH else
0051 FUSION_HASH     define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
0052 FUSION_HASH endif
0053 #else
0054 #   if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
0055 #       define BOOST_FUSION_FOLD_IMPL_ENABLER(T) void
0056 #   else
0057 #       define BOOST_FUSION_FOLD_IMPL_ENABLER(T) typename T::type
0058 #   endif
0059 #endif
0060 
0061 namespace boost { namespace fusion
0062 {
0063     namespace detail
0064     {
0065         template<int SeqSize, typename It, typename State, typename F, typename = void
0066 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0067 FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
0068 #endif
0069 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
0070     (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0071           // Dirty hack: those compilers cannot choose exactly one partial specialization.
0072           , bool = SeqSize == 0
0073 #endif
0074 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0075 FUSION_HASH endif
0076 #endif
0077         >
0078         struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)
0079         {};
0080 
0081         template<typename It, typename State, typename F>
0082         struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<0,It,State,F
0083           , typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
0084 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0085 FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
0086 #endif
0087 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
0088     (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0089           , true
0090 #endif
0091 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0092 FUSION_HASH endif
0093 #endif
0094           >
0095         {
0096             typedef typename State::type type;
0097         };
0098 
0099         template<int SeqSize, typename It, typename State, typename F>
0100         struct BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<SeqSize,It,State,F
0101           , typename boost::enable_if_has_type<
0102 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0103 FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, >= 1500)
0104 #endif
0105 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1500) || \
0106     (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0107                 // Following SFINAE enables to avoid MSVC 9's partial specialization
0108                 // ambiguous bug but MSVC 8 don't compile, and moreover MSVC 8 style
0109                 // workaround won't work with MSVC 9.
0110                 typename boost::disable_if_c<SeqSize == 0, State>::type::type
0111 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0112 FUSION_HASH else
0113                 BOOST_FUSION_FOLD_IMPL_ENABLER(State)
0114 #endif
0115 #else
0116                 BOOST_FUSION_FOLD_IMPL_ENABLER(State)
0117 #endif
0118 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0119 FUSION_HASH endif
0120 #endif
0121             >::type
0122 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0123 FUSION_HASH if BOOST_WORKAROUND BOOST_PREVENT_MACRO_SUBSTITUTION (BOOST_MSVC, < 1500)
0124 #endif
0125 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) || \
0126     (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0127           , false
0128 #endif
0129 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0130 FUSION_HASH endif
0131 #endif
0132           >
0133           : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
0134                 SeqSize-1
0135               , typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
0136               , boost::result_of<
0137                     F(
0138                         typename add_reference<typename State::type>::type,
0139                         BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
0140                     )
0141                 >
0142               , F
0143             >
0144         {};
0145 
0146         template<typename It, typename State, typename F>
0147         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0148         inline typename BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
0149             0
0150           , It
0151           , State
0152           , F
0153         >::type
0154         BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)(mpl::int_<0>, It const&, typename State::type state, F&)
0155         {
0156             return state;
0157         }
0158 
0159         template<typename It, typename State, typename F, int SeqSize>
0160         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0161         inline typename lazy_enable_if_c<
0162             SeqSize != 0
0163           , BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
0164                 SeqSize
0165               , It
0166               , State
0167               , F
0168             >
0169         >::type
0170         BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)(mpl::int_<SeqSize>, It const& it, typename State::type state, F& f)
0171         {
0172             return BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)<
0173                 typename result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION<It>::type
0174               , boost::result_of<
0175                     F(
0176                         typename add_reference<typename State::type>::type,
0177                         BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM(It const)
0178                     )
0179                 >
0180               , F
0181             >(
0182                 mpl::int_<SeqSize-1>()
0183               , fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it)
0184               , f(state, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it))
0185               , f
0186             );
0187         }
0188 
0189         template<typename Seq, typename State, typename F
0190           , bool = traits::is_sequence<Seq>::value
0191           , bool = traits::is_segmented<Seq>::value>
0192         struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)
0193         {};
0194 
0195         template<typename Seq, typename State, typename F>
0196         struct BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F, true, false>
0197           : BOOST_PP_CAT(result_of_it_,BOOST_FUSION_FOLD_NAME)<
0198                 result_of::size<Seq>::value
0199               , BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
0200                     typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
0201                 )
0202               , add_reference<State>
0203               , F
0204             >
0205         {};
0206 
0207         template<typename Seq, typename State, typename F>
0208         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0209         inline typename BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F>::type
0210         BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F& f)
0211         {
0212             return BOOST_PP_CAT(it_,BOOST_FUSION_FOLD_NAME)<
0213                 BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM(
0214                     typename result_of::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION<Seq>::type
0215                 )
0216               , add_reference<State>
0217               , F
0218             >(
0219                 typename result_of::size<Seq>::type()
0220               , BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM(
0221                     fusion::BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION(seq)
0222                 )
0223               , state
0224               , f
0225             );
0226         }
0227     }
0228 
0229     namespace result_of
0230     {
0231         template<typename Seq, typename State, typename F>
0232         struct BOOST_FUSION_FOLD_NAME
0233           : detail::BOOST_PP_CAT(result_of_,BOOST_FUSION_FOLD_NAME)<Seq, State, F>
0234         {};
0235     }
0236 
0237     template<typename Seq, typename State, typename F>
0238     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0239     inline typename result_of::BOOST_FUSION_FOLD_NAME<
0240         Seq
0241       , State const
0242       , F
0243     >::type
0244     BOOST_FUSION_FOLD_NAME(Seq& seq, State const& state, F f)
0245     {
0246         return detail::BOOST_FUSION_FOLD_NAME<Seq, State const, F>(seq, state, f);
0247     }
0248 
0249     template<typename Seq, typename State, typename F>
0250     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0251     inline typename result_of::BOOST_FUSION_FOLD_NAME<
0252         Seq const
0253       , State const
0254       , F
0255     >::type
0256     BOOST_FUSION_FOLD_NAME(Seq const& seq, State const& state, F f)
0257     {
0258         return detail::BOOST_FUSION_FOLD_NAME<Seq const, State const, F>(seq, state, f);
0259     }
0260 
0261     template<typename Seq, typename State, typename F>
0262     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0263     inline typename result_of::BOOST_FUSION_FOLD_NAME<
0264         Seq
0265       , State
0266       , F
0267     >::type
0268     BOOST_FUSION_FOLD_NAME(Seq& seq, State& state, F f)
0269     {
0270         return detail::BOOST_FUSION_FOLD_NAME<Seq, State, F>(seq, state, f);
0271     }
0272 
0273     template<typename Seq, typename State, typename F>
0274     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0275     inline typename result_of::BOOST_FUSION_FOLD_NAME<
0276         Seq const
0277       , State
0278       , F
0279     >::type
0280     BOOST_FUSION_FOLD_NAME(Seq const& seq, State& state, F f)
0281     {
0282         return detail::BOOST_FUSION_FOLD_NAME<Seq const, State, F>(seq, state, f);
0283     }
0284 }}
0285 
0286 #undef BOOST_FUSION_FOLD_NAME
0287 #undef BOOST_FUSION_FOLD_IMPL_ENABLER
0288 #undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_FUNCTION
0289 #undef BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION
0290 #undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_META_TRANSFORM
0291 #undef BOOST_FUSION_FOLD_IMPL_FIRST_IT_TRANSFORM
0292 #undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_META_TRANSFORM
0293 #undef BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM
0294 #undef FUSION_HASH