]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2011 Eric Niebler | |
3 | ||
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ==============================================================================*/ | |
7 | #if !defined(BOOST_FUSION_REVERSE_CONS_HPP_INCLUDED) | |
8 | #define BOOST_FUSION_REVERSE_CONS_HPP_INCLUDED | |
9 | ||
10 | #include <boost/fusion/support/config.hpp> | |
11 | #include <boost/fusion/container/list/cons_fwd.hpp> | |
12 | ||
13 | namespace boost { namespace fusion { namespace detail | |
14 | { | |
15 | //////////////////////////////////////////////////////////////////////////// | |
16 | template<typename Cons, typename State = nil_> | |
17 | struct reverse_cons; | |
18 | ||
19 | template<typename Car, typename Cdr, typename State> | |
20 | struct reverse_cons<cons<Car, Cdr>, State> | |
21 | { | |
22 | typedef reverse_cons<Cdr, cons<Car, State> > impl; | |
23 | typedef typename impl::type type; | |
24 | ||
25 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
26 | static type call(cons<Car, Cdr> const &cons, State const &state = State()) | |
27 | { | |
28 | typedef fusion::cons<Car, State> cdr_type; | |
29 | return impl::call(cons.cdr, cdr_type(cons.car, state)); | |
30 | } | |
31 | }; | |
32 | ||
33 | template<typename State> | |
34 | struct reverse_cons<nil_, State> | |
35 | { | |
36 | typedef State type; | |
37 | ||
38 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
39 | static State const &call(nil_ const &, State const &state = State()) | |
40 | { | |
41 | return state; | |
42 | } | |
43 | }; | |
44 | }}} | |
45 | ||
46 | #endif |