2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
4 #if defined(BOOST_PP_IS_ITERATING)
6 // Copyright Aleksey Gurtovoy 2000-2004
8 // Distributed under the Boost Software License, Version 1.0.
9 // (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 // See http://www.boost.org/libs/mpl for documentation.
18 #include <boost/preprocessor/enum_params.hpp>
19 #include <boost/preprocessor/enum_shifted_params.hpp>
20 #include <boost/preprocessor/comma_if.hpp>
21 #include <boost/preprocessor/repeat.hpp>
22 #include <boost/preprocessor/dec.hpp>
23 #include <boost/preprocessor/cat.hpp>
25 #define i_ BOOST_PP_FRAME_ITERATION(1)
27 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
29 # define AUX778076_VECTOR_TAIL(vector, i_, T) \
30 BOOST_PP_CAT(vector,i_)< \
31 BOOST_PP_ENUM_PARAMS(i_, T) \
37 BOOST_PP_ENUM_PARAMS(i_, typename T)
39 struct BOOST_PP_CAT(vector,i_)
41 BOOST_PP_CAT(T,BOOST_PP_DEC(i_))
42 , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),T)
45 typedef BOOST_PP_CAT(vector,i_) type;
49 # undef AUX778076_VECTOR_TAIL
51 #else // "brute force" implementation
56 BOOST_PP_ENUM_PARAMS(i_, typename T)
58 struct BOOST_PP_CAT(vector,i_)
60 typedef aux::vector_tag<i_> tag;
61 typedef BOOST_PP_CAT(vector,i_) type;
63 # define AUX778076_VECTOR_ITEM(unused, i_, unused2) \
64 typedef BOOST_PP_CAT(T,i_) BOOST_PP_CAT(item,i_); \
67 BOOST_PP_REPEAT(i_, AUX778076_VECTOR_ITEM, unused)
68 # undef AUX778076_VECTOR_ITEM
69 typedef void_ BOOST_PP_CAT(item,i_);
70 typedef BOOST_PP_CAT(T,BOOST_PP_DEC(i_)) back;
72 // Borland forces us to use 'type' here (instead of the class name)
73 typedef v_iter<type,0> begin;
74 typedef v_iter<type,i_> end;
78 struct push_front_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >
80 template< typename Vector, typename T > struct apply
82 typedef BOOST_PP_CAT(vector,i_)<
84 BOOST_PP_COMMA_IF(BOOST_PP_DEC(i_))
85 BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
91 struct pop_front_impl< aux::vector_tag<i_> >
93 template< typename Vector > struct apply
95 typedef BOOST_PP_CAT(vector,BOOST_PP_DEC(i_))<
96 BOOST_PP_ENUM_SHIFTED_PARAMS(i_, typename Vector::item)
103 struct push_back_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >
105 template< typename Vector, typename T > struct apply
107 typedef BOOST_PP_CAT(vector,i_)<
108 BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
109 BOOST_PP_COMMA_IF(BOOST_PP_DEC(i_))
116 struct pop_back_impl< aux::vector_tag<i_> >
118 template< typename Vector > struct apply
120 typedef BOOST_PP_CAT(vector,BOOST_PP_DEC(i_))<
121 BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
128 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
129 && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
131 template< typename V >
134 typedef typename V::BOOST_PP_CAT(item,i_) type;
140 template<> struct v_at_impl<i_>
142 template< typename V_ > struct result_
144 typedef typename V_::BOOST_PP_CAT(item,i_) type;
150 struct at_impl< aux::vector_tag<i_> >
152 template< typename V_, typename N > struct apply
154 typedef typename aux::v_at_impl<BOOST_MPL_AUX_VALUE_WKND(N)::value>
155 ::template result_<V_>::type type;
161 struct front_impl< aux::vector_tag<i_> >
163 template< typename Vector > struct apply
165 typedef typename Vector::item0 type;
170 struct back_impl< aux::vector_tag<i_> >
172 template< typename Vector > struct apply
174 typedef typename Vector::back type;
179 struct empty_impl< aux::vector_tag<i_> >
181 template< typename Vector > struct apply
189 struct size_impl< aux::vector_tag<i_> >
191 template< typename Vector > struct apply
198 struct O1_size_impl< aux::vector_tag<i_> >
199 : size_impl< aux::vector_tag<i_> >
204 struct clear_impl< aux::vector_tag<i_> >
206 template< typename Vector > struct apply
208 typedef vector0<> type;
212 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
214 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
218 #endif // BOOST_PP_IS_ITERATING