Imported Upstream version 1.51.0
[platform/upstream/boost.git] / boost / fusion / container / deque / detail / cpp11_deque_keyed_values.hpp
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/container/deque/detail/keyed_element.hpp>
12 #include <boost/type_traits/add_reference.hpp>
13 #include <boost/type_traits/add_const.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         static type call(
32           typename detail::call_param<Head>::type head
33         , typename detail::call_param<Tail>::type... tail)
34         {
35             return type(
36                 head
37               , deque_keyed_values_impl<next_index, Tail...>::call(tail...)
38             );
39         }
40     };
41
42     struct nil_keyed_element;
43
44     template <typename N>
45     struct deque_keyed_values_impl<N>
46     {
47         typedef nil_keyed_element type;
48         static type call() { return type(); }
49     };
50
51     template <typename ...Elements>
52     struct deque_keyed_values
53       : deque_keyed_values_impl<mpl::int_<0>, Elements...> {};
54 }}}
55
56 #endif