PageRenderTime 22ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/fusion/container/list/detail/build_cons.hpp

http://hadesmem.googlecode.com/
C++ Header | 58 lines | 43 code | 9 blank | 6 comment | 0 complexity | 06581c64fd84ccaac5b70c2decb7cdc4 MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2006 Joel de Guzman
 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(FUSION_BUILD_CONS_09232005_1222)
 8#define FUSION_BUILD_CONS_09232005_1222
 9
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>
15
16namespace boost { namespace fusion { namespace detail
17{
18    template <
19        typename First
20      , typename Last
21      , bool is_empty = result_of::equal_to<First, Last>::value>
22    struct build_cons;
23
24    template <typename First, typename Last>
25    struct build_cons<First, Last, true>
26    {
27        typedef nil type;
28        
29        static nil
30        call(First const&, Last const&)
31        {
32            return nil();
33        }
34    };
35
36    template <typename First, typename Last>
37    struct build_cons<First, Last, false>
38    {
39        typedef  
40            build_cons<typename result_of::next<First>::type, Last>
41        next_build_cons;
42
43        typedef cons<
44            typename result_of::value_of<First>::type
45          , typename next_build_cons::type> 
46        type;
47
48        static type
49        call(First const& f, Last const& l)
50        {
51            typename result_of::deref<First>::type v = *f;
52            return type(v, next_build_cons::call(fusion::next(f), l));
53        }
54    };
55
56}}}
57
58#endif