]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/vector/aux_/numbered.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
493bd5ff44edddd573ec2bc0b06a35bdbc44e454
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / vector / aux_ / numbered.hpp
1 \r
2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION\r
3 \r
4 #if defined(BOOST_PP_IS_ITERATING)\r
5 \r
6 // Copyright Aleksey Gurtovoy 2000-2004\r
7 //\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
11 //\r
12 // See http://www.boost.org/libs/mpl for documentation.\r
13 \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
17 \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
24 \r
25 #define i_ BOOST_PP_FRAME_ITERATION(1)\r
26 \r
27 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)\r
28 \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
32         > \\r
33     /**/\r
34 \r
35 #if i_ > 0\r
36 template<\r
37       BOOST_PP_ENUM_PARAMS(i_, typename T)\r
38     >\r
39 struct BOOST_PP_CAT(vector,i_)\r
40     : v_item<\r
41           BOOST_PP_CAT(T,BOOST_PP_DEC(i_))\r
42         , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),T)\r
43         >\r
44 {\r
45     typedef BOOST_PP_CAT(vector,i_) type;\r
46 };\r
47 #endif\r
48 \r
49 #   undef AUX778076_VECTOR_TAIL\r
50 \r
51 #else // "brute force" implementation\r
52 \r
53 #   if i_ > 0\r
54 \r
55 template<\r
56       BOOST_PP_ENUM_PARAMS(i_, typename T)\r
57     >\r
58 struct BOOST_PP_CAT(vector,i_)\r
59 {\r
60     typedef aux::vector_tag<i_> tag;\r
61     typedef BOOST_PP_CAT(vector,i_) type;\r
62 \r
63 #   define AUX778076_VECTOR_ITEM(unused, i_, unused2) \\r
64     typedef BOOST_PP_CAT(T,i_) BOOST_PP_CAT(item,i_); \\r
65     /**/\r
66 \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
71 \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
75 };\r
76 \r
77 template<>\r
78 struct push_front_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >\r
79 {\r
80     template< typename Vector, typename T > struct apply\r
81     {\r
82         typedef BOOST_PP_CAT(vector,i_)<\r
83               T\r
84               BOOST_PP_COMMA_IF(BOOST_PP_DEC(i_))\r
85               BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)\r
86             > type;\r
87     };\r
88 };\r
89 \r
90 template<>\r
91 struct pop_front_impl< aux::vector_tag<i_> >\r
92 {\r
93     template< typename Vector > struct apply\r
94     {\r
95         typedef BOOST_PP_CAT(vector,BOOST_PP_DEC(i_))<\r
96               BOOST_PP_ENUM_SHIFTED_PARAMS(i_, typename Vector::item)\r
97             > type;\r
98     };\r
99 };\r
100 \r
101 \r
102 template<>\r
103 struct push_back_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >\r
104 {\r
105     template< typename Vector, typename T > struct apply\r
106     {\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
110               T\r
111             > type;\r
112     };\r
113 };\r
114 \r
115 template<>\r
116 struct pop_back_impl< aux::vector_tag<i_> >\r
117 {\r
118     template< typename Vector > struct apply\r
119     {\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
122             > type;\r
123     };\r
124 };\r
125 \r
126 #   endif // i_ > 0\r
127 \r
128 #   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \\r
129     && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)\r
130 \r
131 template< typename V >\r
132 struct v_at<V,i_>\r
133 {\r
134     typedef typename V::BOOST_PP_CAT(item,i_) type;\r
135 };\r
136 \r
137 #   else\r
138 \r
139 namespace aux {\r
140 template<> struct v_at_impl<i_>\r
141 {\r
142     template< typename V_ > struct result_\r
143     {\r
144         typedef typename V_::BOOST_PP_CAT(item,i_) type;\r
145     };\r
146 };\r
147 }\r
148 \r
149 template<>\r
150 struct at_impl< aux::vector_tag<i_> >\r
151 {\r
152     template< typename V_, typename N > struct apply\r
153     {\r
154         typedef typename aux::v_at_impl<BOOST_MPL_AUX_VALUE_WKND(N)::value>\r
155             ::template result_<V_>::type type;\r
156     };\r
157 };\r
158 \r
159 #if i_ > 0\r
160 template<>\r
161 struct front_impl< aux::vector_tag<i_> >\r
162 {\r
163     template< typename Vector > struct apply\r
164     {\r
165         typedef typename Vector::item0 type;\r
166     };\r
167 };\r
168 \r
169 template<>\r
170 struct back_impl< aux::vector_tag<i_> >\r
171 {\r
172     template< typename Vector > struct apply\r
173     {\r
174         typedef typename Vector::back type;\r
175     };\r
176 };\r
177 \r
178 template<>\r
179 struct empty_impl< aux::vector_tag<i_> >\r
180 {\r
181     template< typename Vector > struct apply\r
182         : false_\r
183     {\r
184     };\r
185 };\r
186 #endif\r
187 \r
188 template<>\r
189 struct size_impl< aux::vector_tag<i_> >\r
190 {\r
191     template< typename Vector > struct apply\r
192         : long_<i_>\r
193     {\r
194     };\r
195 };\r
196 \r
197 template<>\r
198 struct O1_size_impl< aux::vector_tag<i_> >\r
199     : size_impl< aux::vector_tag<i_> >\r
200 {\r
201 };\r
202 \r
203 template<>\r
204 struct clear_impl< aux::vector_tag<i_> >\r
205 {\r
206     template< typename Vector > struct apply\r
207     {\r
208         typedef vector0<> type;\r
209     };\r
210 };\r
211 \r
212 #   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION\r
213 \r
214 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES\r
215 \r
216 #undef i_\r
217 \r
218 #endif // BOOST_PP_IS_ITERATING\r