1 /*=============================================================================
2 Copyright (c) 2001-2006 Joel de Guzman
3 Copyright (c) 2006 Dan Marsden
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
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>
24 namespace boost
{ namespace fusion
{ namespace detail
32 template <typename Iterator
>
38 template <typename Iterator
>
39 static typename apply
<Iterator
>::type
46 #define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
47 typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
48 BOOST_PP_CAT(I, BOOST_PP_INC(n));
50 #define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
51 typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
52 BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
54 #define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
55 typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
58 #define BOOST_PP_FILENAME_1 <boost/fusion/container/deque/detail/as_deque.hpp>
59 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
60 #include BOOST_PP_ITERATE()
62 #undef BOOST_FUSION_NEXT_ITERATOR
63 #undef BOOST_FUSION_NEXT_CALL_ITERATOR
64 #undef BOOST_FUSION_VALUE_OF_ITERATOR
69 #else // defined(BOOST_PP_IS_ITERATING)
70 ///////////////////////////////////////////////////////////////////////////////
72 // Preprocessor vertical repetition code
74 ///////////////////////////////////////////////////////////////////////////////
76 #define N BOOST_PP_ITERATION()
81 template <typename I0
>
84 BOOST_PP_REPEAT(N
, BOOST_FUSION_NEXT_ITERATOR
, _
)
85 BOOST_PP_REPEAT(N
, BOOST_FUSION_VALUE_OF_ITERATOR
, _
)
86 typedef deque
<BOOST_PP_ENUM_PARAMS(N
, T
)> type
;
89 template <typename Iterator
>
90 static typename apply
<Iterator
>::type
91 call(Iterator
const& i0
)
93 typedef apply
<Iterator
> gen
;
94 typedef typename
gen::type result
;
95 BOOST_PP_REPEAT(BOOST_PP_DEC(N
), BOOST_FUSION_NEXT_CALL_ITERATOR
, _
)
96 return result(BOOST_PP_ENUM_PARAMS(N
, *i
));
101 #endif // defined(BOOST_PP_IS_ITERATING)