]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2005-2012 Joel de Guzman | |
3 | Copyright (c) 2005-2006 Dan Marsden | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ==============================================================================*/ | |
8 | #if !defined(BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901) | |
9 | #define BOOST_FUSION_DEQUE_DETAIL_CPP11_DEQUE_KEYED_VALUES_07042012_1901 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/support/detail/access.hpp> | |
13 | #include <boost/fusion/container/deque/detail/keyed_element.hpp> | |
14 | #include <boost/mpl/int.hpp> | |
15 | ||
16 | namespace boost { namespace fusion { namespace detail | |
17 | { | |
18 | template<typename Key, typename Value, typename Rest> | |
19 | struct keyed_element; | |
20 | ||
21 | template <typename N, typename ...Elements> | |
22 | struct deque_keyed_values_impl; | |
23 | ||
24 | template <typename N, typename Head, typename ...Tail> | |
25 | struct deque_keyed_values_impl<N, Head, Tail...> | |
26 | { | |
27 | typedef mpl::int_<(N::value + 1)> next_index; | |
28 | typedef typename deque_keyed_values_impl<next_index, Tail...>::type tail; | |
29 | typedef keyed_element<N, Head, tail> type; | |
30 | ||
31 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
32 | static type construct( | |
33 | typename detail::call_param<Head>::type head | |
34 | , typename detail::call_param<Tail>::type... tail) | |
35 | { | |
36 | return type( | |
37 | head | |
38 | , deque_keyed_values_impl<next_index, Tail...>::construct(tail...) | |
39 | ); | |
40 | } | |
41 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
42 | template <typename Head_, typename ...Tail_> | |
43 | BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
44 | static type forward_(Head_&& head, Tail_&&... tail) | |
45 | { | |
46 | return type( | |
47 | BOOST_FUSION_FWD_ELEM(Head_, head) | |
48 | , deque_keyed_values_impl<next_index, Tail_...>:: | |
49 | forward_(BOOST_FUSION_FWD_ELEM(Tail_, tail)...) | |
50 | ); | |
51 | } | |
52 | #endif | |
53 | }; | |
54 | ||
55 | struct nil_keyed_element; | |
56 | ||
57 | template <typename N> | |
58 | struct deque_keyed_values_impl<N> | |
59 | { | |
60 | typedef nil_keyed_element type; | |
61 | ||
62 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
63 | static type construct() { return type(); } | |
64 | ||
65 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
66 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
67 | static type forward_() { return type(); } | |
68 | #endif | |
69 | }; | |
70 | ||
71 | template <typename ...Elements> | |
72 | struct deque_keyed_values | |
73 | : deque_keyed_values_impl<mpl::int_<0>, Elements...> {}; | |
74 | }}} | |
75 | ||
76 | #endif |