fix doc example typo
[boost.git] / boost / fusion / container / list / detail / build_cons.hpp
blobbefbd4e9ceddca982d9ce2d3152eb3368a00d2bd
1 /*=============================================================================
2 Copyright (c) 2001-2006 Joel de Guzman
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(FUSION_BUILD_CONS_09232005_1222)
8 #define FUSION_BUILD_CONS_09232005_1222
10 #include <boost/fusion/container/list/cons.hpp>
11 #include <boost/fusion/iterator/equal_to.hpp>
12 #include <boost/fusion/iterator/next.hpp>
13 #include <boost/fusion/iterator/value_of.hpp>
14 #include <boost/fusion/iterator/deref.hpp>
16 namespace boost { namespace fusion { namespace detail
18 template <
19 typename First
20 , typename Last
21 , bool is_empty = result_of::equal_to<First, Last>::value>
22 struct build_cons;
24 template <typename First, typename Last>
25 struct build_cons<First, Last, true>
27 typedef nil type;
29 static nil
30 call(First const&, Last const&)
32 return nil();
36 template <typename First, typename Last>
37 struct build_cons<First, Last, false>
39 typedef
40 build_cons<typename result_of::next<First>::type, Last>
41 next_build_cons;
43 typedef cons<
44 typename result_of::value_of<First>::type
45 , typename next_build_cons::type>
46 type;
48 static type
49 call(First const& f, Last const& l)
51 return type(*f, next_build_cons::call(fusion::next(f), l));
55 }}}
57 #endif