]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2012-2014 Kohei Takahashi | |
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_BUILD_CONS_10172012_0130) | |
8 | #define BOOST_FUSION_BUILD_CONS_10172012_0130 | |
9 | ||
10 | #include <boost/tuple/tuple.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 | ||
16 | namespace 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_tuple_cons; | |
23 | ||
24 | template <typename First, typename Last> | |
25 | struct build_tuple_cons<First, Last, true> | |
26 | { | |
27 | typedef boost::tuples::null_type type; | |
28 | ||
29 | BOOST_FUSION_GPU_ENABLED | |
30 | static type | |
31 | call(First const&, Last const&) | |
32 | { | |
33 | return type(); | |
34 | } | |
35 | }; | |
36 | ||
37 | template <typename First, typename Last> | |
38 | struct build_tuple_cons<First, Last, false> | |
39 | { | |
40 | typedef | |
41 | build_tuple_cons<typename result_of::next<First>::type, Last> | |
42 | next_build_tuple_cons; | |
43 | ||
44 | typedef boost::tuples::cons< | |
45 | typename result_of::value_of<First>::type | |
46 | , typename next_build_tuple_cons::type> | |
47 | type; | |
48 | ||
49 | BOOST_FUSION_GPU_ENABLED | |
50 | static type | |
51 | call(First const& f, Last const& l) | |
52 | { | |
53 | typename result_of::value_of<First>::type v = *f; | |
54 | return type(v, next_build_tuple_cons::call(fusion::next(f), l)); | |
55 | } | |
56 | }; | |
57 | }}} | |
58 | ||
59 | #endif |