Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 2011 Eric Niebler
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_FUSION_FOLD_S_HPP_INCLUDED)
0008 #define BOOST_FUSION_FOLD_S_HPP_INCLUDED
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/algorithm/iteration/fold_fwd.hpp>
0012 #include <boost/fusion/support/segmented_fold_until.hpp>
0013 #include <boost/mpl/bool.hpp>
0014 
0015 namespace boost { namespace fusion { namespace detail
0016 {
0017 #ifdef _MSC_VER
0018 #  pragma warning(push)
0019 #  pragma warning(disable: 4512) // assignment operator could not be generated.
0020 #endif
0021     template <typename Fun>
0022     struct segmented_fold_fun
0023     {
0024         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0025         explicit segmented_fold_fun(Fun const& f)
0026           : fun(f)
0027         {}
0028 
0029         Fun const& fun;
0030 
0031         template <typename Sequence, typename State, typename Context>
0032         struct apply
0033         {
0034             typedef typename result_of::fold<Sequence, State, Fun>::type type;
0035             typedef mpl::true_ continue_type;
0036 
0037             BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0038             static type call(Sequence& seq, State const& state, Context const&, segmented_fold_fun const& fun)
0039             {
0040                 return fusion::fold(seq, state, fun.fun);
0041             }
0042         };
0043     };
0044 #ifdef _MSC_VER
0045 #  pragma warning(pop)
0046 #endif
0047 
0048     // The default implementation of this lives in detail/fold.hpp
0049     template <typename Sequence, typename State, typename Fun, bool IsSequence, bool IsSegmented>
0050     struct result_of_fold;
0051 
0052     template <typename Sequence, typename State, typename Fun>
0053     struct result_of_fold<Sequence, State, Fun, true, true>
0054     {
0055         typedef
0056             typename result_of::segmented_fold_until<
0057                 Sequence,
0058                 State,
0059                 segmented_fold_fun<Fun>
0060             >::type
0061         type;
0062 
0063         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0064         static type call(Sequence& seq, State& state, Fun& fun)
0065         {
0066             return fusion::segmented_fold_until(seq, state, segmented_fold_fun<Fun>(fun));
0067         }
0068     };
0069 }}}
0070 
0071 #endif