1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2015 Kohei Takahashi
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(FUSION_ACCUMULATE_09172005_1032)
9 #define FUSION_ACCUMULATE_09172005_1032
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/algorithm/iteration/accumulate_fwd.hpp>
13 #include <boost/fusion/algorithm/iteration/fold.hpp>
15 namespace boost { namespace fusion
21 template <typename Sequence, typename State, typename F>
23 : result_of::fold<Sequence, State, F>
27 template <typename Sequence, typename State, typename F>
28 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
29 inline typename result_of::accumulate<Sequence, State const, F>::type
30 accumulate(Sequence& seq, State const& state, F f)
32 return fusion::fold(seq, state, f);
35 template <typename Sequence, typename State, typename F>
36 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
37 inline typename result_of::accumulate<Sequence const, State const, F>::type
38 accumulate(Sequence const& seq, State const& state, F f)
40 return fusion::fold(seq, state, f);