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