Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / container / deque / detail / cpp03 / as_deque.hpp
1 /*=============================================================================
2     Copyright (c) 2005-2012 Joel de Guzman
3     Copyright (c) 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 #ifndef BOOST_PP_IS_ITERATING
9 #if !defined(FUSION_AS_DEQUE_20061213_2210)
10 #define FUSION_AS_DEQUE_20061213_2210
11
12 #include <boost/preprocessor/iterate.hpp>
13 #include <boost/preprocessor/repetition/enum_params.hpp>
14 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
15 #include <boost/preprocessor/repetition/repeat.hpp>
16 #include <boost/preprocessor/cat.hpp>
17 #include <boost/preprocessor/inc.hpp>
18 #include <boost/preprocessor/dec.hpp>
19 #include <boost/fusion/container/deque/deque.hpp>
20 #include <boost/fusion/iterator/value_of.hpp>
21 #include <boost/fusion/iterator/deref.hpp>
22 #include <boost/fusion/iterator/next.hpp>
23
24 namespace boost { namespace fusion { namespace detail
25 {
26     template <int size>
27     struct as_deque;
28
29     template <>
30     struct as_deque<0>
31     {
32         template <typename Iterator>
33         struct apply
34         {
35             typedef deque<> type;
36         };
37
38         template <typename Iterator>
39         BOOST_FUSION_GPU_ENABLED
40         static typename apply<Iterator>::type
41         call(Iterator)
42         {
43             return deque<>();
44         }
45     };
46 }}}
47
48 #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
49 #include <boost/fusion/container/deque/detail/cpp03/preprocessed/as_deque.hpp>
50 #else
51 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
52 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/as_deque" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
53 #endif
54
55 /*=============================================================================
56     Copyright (c) 2001-2011 Joel de Guzman
57
58     Distributed under the Boost Software License, Version 1.0. (See accompanying
59     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
60
61     This is an auto-generated file. Do not edit!
62 ==============================================================================*/
63
64 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
65 #pragma wave option(preserve: 1)
66 #endif
67
68 namespace boost { namespace fusion { namespace detail
69 {
70 #define BOOST_FUSION_NEXT_ITERATOR(z, n, data)                                  \
71     typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type          \
72         BOOST_PP_CAT(I, BOOST_PP_INC(n));
73
74 #define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data)                             \
75     typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n))                              \
76         BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
77
78 #define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data)                              \
79     typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type      \
80         BOOST_PP_CAT(T, n);
81
82 #define BOOST_PP_FILENAME_1 <boost/fusion/container/deque/detail/cpp03/as_deque.hpp>
83 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
84 #include BOOST_PP_ITERATE()
85
86 #undef BOOST_FUSION_NEXT_ITERATOR
87 #undef BOOST_FUSION_NEXT_CALL_ITERATOR
88 #undef BOOST_FUSION_VALUE_OF_ITERATOR
89
90 }}}
91
92 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
93 #pragma wave option(output: null)
94 #endif
95
96 #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
97
98 #endif
99 #else // defined(BOOST_PP_IS_ITERATING)
100 ///////////////////////////////////////////////////////////////////////////////
101 //
102 //  Preprocessor vertical repetition code
103 //
104 ///////////////////////////////////////////////////////////////////////////////
105
106 #define N BOOST_PP_ITERATION()
107
108     template <>
109     struct as_deque<N>
110     {
111         template <typename I0>
112         struct apply
113         {
114             BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
115             BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
116             typedef deque<BOOST_PP_ENUM_PARAMS(N, T)> type;
117         };
118
119         template <typename Iterator>
120         BOOST_FUSION_GPU_ENABLED
121         static typename apply<Iterator>::type
122         call(Iterator const& i0)
123         {
124             typedef apply<Iterator> gen;
125             typedef typename gen::type result;
126             BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
127             return result(BOOST_PP_ENUM_PARAMS(N, *i));
128         }
129     };
130
131 #undef N
132 #endif // defined(BOOST_PP_IS_ITERATING)
133