Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:55

0001 
0002 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
0003 
0004 #if defined(BOOST_PP_IS_ITERATING)
0005 
0006 // Copyright Aleksey Gurtovoy 2000-2004
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. 
0009 // (See accompanying file LICENSE_1_0.txt or copy at 
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 //
0012 // See http://www.boost.org/libs/mpl for documentation.
0013 
0014 // $Id$
0015 // $Date$
0016 // $Revision$
0017 
0018 #include <boost/preprocessor/enum_params.hpp>
0019 #include <boost/preprocessor/enum_shifted_params.hpp>
0020 #include <boost/preprocessor/comma_if.hpp>
0021 #include <boost/preprocessor/repeat.hpp>
0022 #include <boost/preprocessor/dec.hpp>
0023 #include <boost/preprocessor/cat.hpp>
0024 
0025 #define i_ BOOST_PP_FRAME_ITERATION(1)
0026 
0027 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
0028 
0029 #   define AUX778076_VECTOR_TAIL(vector, i_, T) \
0030     BOOST_PP_CAT(vector,i_)< \
0031           BOOST_PP_ENUM_PARAMS(i_, T) \
0032         > \
0033     /**/
0034 
0035 #if i_ > 0
0036 template<
0037       BOOST_PP_ENUM_PARAMS(i_, typename T)
0038     >
0039 struct BOOST_PP_CAT(vector,i_)
0040     : v_item<
0041           BOOST_PP_CAT(T,BOOST_PP_DEC(i_))
0042         , AUX778076_VECTOR_TAIL(vector,BOOST_PP_DEC(i_),T)
0043         >
0044 {
0045     typedef BOOST_PP_CAT(vector,i_) type;
0046 };
0047 #endif
0048 
0049 #   undef AUX778076_VECTOR_TAIL
0050 
0051 #else // "brute force" implementation
0052 
0053 #   if i_ > 0
0054 
0055 template<
0056       BOOST_PP_ENUM_PARAMS(i_, typename T)
0057     >
0058 struct BOOST_PP_CAT(vector,i_)
0059 {
0060     typedef aux::vector_tag<i_> tag;
0061     typedef BOOST_PP_CAT(vector,i_) type;
0062 
0063 #   define AUX778076_VECTOR_ITEM(unused, i_, unused2) \
0064     typedef BOOST_PP_CAT(T,i_) BOOST_PP_CAT(item,i_); \
0065     /**/
0066 
0067     BOOST_PP_REPEAT(i_, AUX778076_VECTOR_ITEM, unused)
0068 #   undef AUX778076_VECTOR_ITEM
0069     typedef void_ BOOST_PP_CAT(item,i_);
0070     typedef BOOST_PP_CAT(T,BOOST_PP_DEC(i_)) back;
0071 
0072     // Borland forces us to use 'type' here (instead of the class name)
0073     typedef v_iter<type,0> begin;
0074     typedef v_iter<type,i_> end;
0075 };
0076 
0077 template<>
0078 struct push_front_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >
0079 {
0080     template< typename Vector, typename T > struct apply
0081     {
0082         typedef BOOST_PP_CAT(vector,i_)<
0083               T
0084               BOOST_PP_COMMA_IF(BOOST_PP_DEC(i_))
0085               BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
0086             > type;
0087     };
0088 };
0089 
0090 template<>
0091 struct pop_front_impl< aux::vector_tag<i_> >
0092 {
0093     template< typename Vector > struct apply
0094     {
0095         typedef BOOST_PP_CAT(vector,BOOST_PP_DEC(i_))<
0096               BOOST_PP_ENUM_SHIFTED_PARAMS(i_, typename Vector::item)
0097             > type;
0098     };
0099 };
0100 
0101 
0102 template<>
0103 struct push_back_impl< aux::vector_tag<BOOST_PP_DEC(i_)> >
0104 {
0105     template< typename Vector, typename T > struct apply
0106     {
0107         typedef BOOST_PP_CAT(vector,i_)<
0108               BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
0109               BOOST_PP_COMMA_IF(BOOST_PP_DEC(i_))
0110               T
0111             > type;
0112     };
0113 };
0114 
0115 template<>
0116 struct pop_back_impl< aux::vector_tag<i_> >
0117 {
0118     template< typename Vector > struct apply
0119     {
0120         typedef BOOST_PP_CAT(vector,BOOST_PP_DEC(i_))<
0121               BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(i_), typename Vector::item)
0122             > type;
0123     };
0124 };
0125 
0126 #   endif // i_ > 0
0127 
0128 #   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
0129     && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
0130 
0131 template< typename V >
0132 struct v_at<V,i_>
0133 {
0134     typedef typename V::BOOST_PP_CAT(item,i_) type;
0135 };
0136 
0137 #   else
0138 
0139 namespace aux {
0140 template<> struct v_at_impl<i_>
0141 {
0142     template< typename V_ > struct result_
0143     {
0144         typedef typename V_::BOOST_PP_CAT(item,i_) type;
0145     };
0146 };
0147 }
0148 
0149 template<>
0150 struct at_impl< aux::vector_tag<i_> >
0151 {
0152     template< typename V_, typename N > struct apply
0153     {
0154         typedef typename aux::v_at_impl<BOOST_MPL_AUX_VALUE_WKND(N)::value>
0155             ::template result_<V_>::type type;
0156     };
0157 };
0158 
0159 #if i_ > 0
0160 template<>
0161 struct front_impl< aux::vector_tag<i_> >
0162 {
0163     template< typename Vector > struct apply
0164     {
0165         typedef typename Vector::item0 type;
0166     };
0167 };
0168 
0169 template<>
0170 struct back_impl< aux::vector_tag<i_> >
0171 {
0172     template< typename Vector > struct apply
0173     {
0174         typedef typename Vector::back type;
0175     };
0176 };
0177 
0178 template<>
0179 struct empty_impl< aux::vector_tag<i_> >
0180 {
0181     template< typename Vector > struct apply
0182         : false_
0183     {
0184     };
0185 };
0186 #endif
0187 
0188 template<>
0189 struct size_impl< aux::vector_tag<i_> >
0190 {
0191     template< typename Vector > struct apply
0192         : long_<i_>
0193     {
0194     };
0195 };
0196 
0197 template<>
0198 struct O1_size_impl< aux::vector_tag<i_> >
0199     : size_impl< aux::vector_tag<i_> >
0200 {
0201 };
0202 
0203 template<>
0204 struct clear_impl< aux::vector_tag<i_> >
0205 {
0206     template< typename Vector > struct apply
0207     {
0208         typedef vector0<> type;
0209     };
0210 };
0211 
0212 #   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0213 
0214 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
0215 
0216 #undef i_
0217 
0218 #endif // BOOST_PP_IS_ITERATING