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/container/list/cons_fwd.hpp>
12 namespace boost { namespace fusion { namespace detail
14 ////////////////////////////////////////////////////////////////////////////
15 template<typename Cons, typename State = nil_>
18 template<typename Car, typename Cdr, typename State>
19 struct reverse_cons<cons<Car, Cdr>, State>
21 typedef reverse_cons<Cdr, cons<Car, State> > impl;
22 typedef typename impl::type type;
24 static type call(cons<Car, Cdr> const &cons, State const &state = State())
26 typedef fusion::cons<Car, State> cdr_type;
27 return impl::call(cons.cdr, cdr_type(cons.car, state));
31 template<typename State>
32 struct reverse_cons<nil_, State>
36 static State const &call(nil_ const &, State const &state = State())