Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:43

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_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED)
0008 #define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/type_traits/is_const.hpp>
0012 #include <boost/utility/enable_if.hpp>
0013 #include <boost/fusion/support/detail/segmented_fold_until_impl.hpp>
0014 
0015 namespace boost { namespace fusion
0016 {
0017     //auto segmented_fold_until(seq, state, fun)
0018     //{
0019     //  return first(segmented_fold_until_impl(seq, state, nil_, fun));
0020     //}
0021 
0022     namespace result_of
0023     {
0024         template <typename Sequence, typename State, typename Fun>
0025         struct segmented_fold_until
0026         {
0027             typedef
0028                 detail::segmented_fold_until_impl<
0029                     Sequence
0030                   , State
0031                   , fusion::nil_
0032                   , Fun
0033                 >
0034             filter;
0035 
0036             typedef
0037                 typename filter::type
0038             type;
0039         };
0040     }
0041 
0042     template <typename Sequence, typename State, typename Fun>
0043     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0044     inline typename
0045         lazy_disable_if<
0046             is_const<Sequence>
0047           , result_of::segmented_fold_until<Sequence, State, Fun>
0048         >::type
0049     segmented_fold_until(Sequence& seq, State const& state, Fun const& fun)
0050     {
0051         typedef
0052             typename result_of::segmented_fold_until<Sequence, State, Fun>::filter
0053         filter;
0054 
0055         return filter::call(seq, state, fusion::nil_(), fun);
0056     }
0057 
0058     template <typename Sequence, typename State, typename Fun>
0059     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0060     inline typename result_of::segmented_fold_until<Sequence const, State, Fun>::type
0061     segmented_fold_until(Sequence const& seq, State const& state, Fun const& fun)
0062     {
0063         typedef
0064             typename result_of::segmented_fold_until<Sequence const, State, Fun>::filter
0065         filter;
0066 
0067         return filter::call(seq, state, fusion::nil_(), fun);
0068     }
0069 }}
0070 
0071 #endif