]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | Copyright (c) 2015 Kohei Takahashi | |
4 | ||
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 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/algorithm/iteration/accumulate_fwd.hpp> | |
13 | #include <boost/fusion/algorithm/iteration/fold.hpp> | |
14 | ||
15 | namespace boost { namespace fusion | |
16 | { | |
17 | struct void_; | |
18 | ||
19 | namespace result_of | |
20 | { | |
21 | template <typename Sequence, typename State, typename F> | |
22 | struct accumulate | |
23 | : result_of::fold<Sequence, State, F> | |
24 | {}; | |
25 | } | |
26 | ||
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) | |
31 | { | |
32 | return fusion::fold(seq, state, f); | |
33 | } | |
34 | ||
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) | |
39 | { | |
40 | return fusion::fold(seq, state, f); | |
41 | } | |
42 | }} | |
43 | ||
44 | #endif | |
45 |