1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
/*=============================================================================
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_FOLD_UNTIL_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/detail/segmented_fold_until_impl.hpp>
namespace boost { namespace fusion
{
//auto segmented_fold_until(seq, state, fun)
//{
// return first(segmented_fold_until_impl(seq, state, nil_, fun));
//}
namespace result_of
{
template <typename Sequence, typename State, typename Fun>
struct segmented_fold_until
{
typedef
detail::segmented_fold_until_impl<
Sequence
, State
, fusion::nil_
, Fun
>
filter;
typedef
typename filter::type
type;
};
}
template <typename Sequence, typename State, typename Fun>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename
lazy_disable_if<
is_const<Sequence>
, result_of::segmented_fold_until<Sequence, State, Fun>
>::type
segmented_fold_until(Sequence& seq, State const& state, Fun const& fun)
{
typedef
typename result_of::segmented_fold_until<Sequence, State, Fun>::filter
filter;
return filter::call(seq, state, fusion::nil_(), fun);
}
template <typename Sequence, typename State, typename Fun>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::segmented_fold_until<Sequence const, State, Fun>::type
segmented_fold_until(Sequence const& seq, State const& state, Fun const& fun)
{
typedef
typename result_of::segmented_fold_until<Sequence const, State, Fun>::filter
filter;
return filter::call(seq, state, fusion::nil_(), fun);
}
}}
#endif
|