1 /*=============================================================================
2 Copyright (c) 2011 Eric Niebler
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
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/container/list/cons_fwd.hpp>
13 namespace boost { namespace fusion { namespace detail
15 ////////////////////////////////////////////////////////////////////////////
16 template<typename Cons, typename State = nil_>
19 template<typename Car, typename Cdr, typename State>
20 struct reverse_cons<cons<Car, Cdr>, State>
22 typedef reverse_cons<Cdr, cons<Car, State> > impl;
23 typedef typename impl::type type;
25 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
26 static type call(cons<Car, Cdr> const &cons, State const &state = State())
28 typedef fusion::cons<Car, State> cdr_type;
29 return impl::call(cons.cdr, cdr_type(cons.car, state));
33 template<typename State>
34 struct reverse_cons<nil_, State>
38 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
39 static State const &call(nil_ const &, State const &state = State())