File indexing completed on 2025-01-18 09:41:54
0001
0002 #ifndef BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
0003 #define BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/at_fwd.hpp>
0018 #include <boost/mpl/vector/aux_/tag.hpp>
0019 #include <boost/mpl/long.hpp>
0020 #include <boost/mpl/void.hpp>
0021 #include <boost/mpl/aux_/nttp_decl.hpp>
0022 #include <boost/mpl/aux_/type_wrapper.hpp>
0023 #include <boost/mpl/aux_/value_wknd.hpp>
0024 #include <boost/mpl/aux_/config/typeof.hpp>
0025 #include <boost/mpl/aux_/config/ctps.hpp>
0026
0027 namespace boost { namespace mpl {
0028
0029 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
0030
0031 template< typename Vector, long n_ >
0032 struct v_at_impl
0033 {
0034 typedef long_< (Vector::lower_bound_::value + n_) > index_;
0035 typedef __typeof__( Vector::item_(index_()) ) type;
0036 };
0037
0038
0039 template< typename Vector, long n_ >
0040 struct v_at
0041 : aux::wrapped_type< typename v_at_impl<Vector,n_>::type >
0042 {
0043 };
0044
0045 template<>
0046 struct at_impl< aux::vector_tag >
0047 {
0048 template< typename Vector, typename N > struct apply
0049 : v_at<
0050 Vector
0051 , BOOST_MPL_AUX_VALUE_WKND(N)::value
0052 >
0053 {
0054 };
0055 };
0056
0057 #else
0058
0059 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
0060 && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
0061
0062 template< typename Vector, BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at;
0063
0064 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) >
0065 struct at_impl< aux::vector_tag<n_> >
0066 {
0067 template< typename Vector, typename N > struct apply
0068 #if !defined(BOOST_BORLANDC)
0069 : v_at<
0070 Vector
0071 , BOOST_MPL_AUX_VALUE_WKND(N)::value
0072 >
0073 {
0074 #else
0075 {
0076 typedef typename v_at<
0077 Vector
0078 , BOOST_MPL_AUX_VALUE_WKND(N)::value
0079 >::type type;
0080 #endif
0081 };
0082 };
0083
0084 # else
0085
0086 namespace aux {
0087
0088 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at_impl
0089 {
0090 template< typename V > struct result_;
0091 };
0092
0093
0094 template<> struct v_at_impl<-1>
0095 {
0096 template< typename V > struct result_
0097 {
0098 typedef void_ type;
0099 };
0100 };
0101
0102 }
0103
0104 template< typename T, BOOST_MPL_AUX_NTTP_DECL(long, n_) >
0105 struct v_at
0106 : aux::v_at_impl<n_>::template result_<T>
0107 {
0108 };
0109
0110 # endif
0111
0112 #endif
0113
0114 }}
0115
0116 #endif