2 #ifndef BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
3 #define BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2000-2004
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 // See http://www.boost.org/libs/mpl for documentation.
13 // $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/at.hpp,v $
14 // $Date: 2004/12/20 19:35:33 $
17 #include <boost/mpl/at_fwd.hpp>
18 #include <boost/mpl/vector/aux_/tag.hpp>
19 #include <boost/mpl/long.hpp>
20 #include <boost/mpl/void.hpp>
21 #include <boost/mpl/aux_/nttp_decl.hpp>
22 #include <boost/mpl/aux_/type_wrapper.hpp>
23 #include <boost/mpl/aux_/value_wknd.hpp>
24 #include <boost/mpl/aux_/config/typeof.hpp>
25 #include <boost/mpl/aux_/config/ctps.hpp>
27 namespace boost { namespace mpl {
29 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
31 template< typename Vector, long n_ >
34 typedef long_< (Vector::lower_bound_::value + n_) > index_;
35 typedef __typeof__( Vector::item_(index_()) ) type;
39 template< typename Vector, long n_ >
41 : aux::wrapped_type< typename v_at_impl<Vector,n_>::type >
46 struct at_impl< aux::vector_tag >
48 template< typename Vector, typename N > struct apply
51 , BOOST_MPL_AUX_VALUE_WKND(N)::value
59 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
60 && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
62 template< typename Vector, BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at;
64 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) >
65 struct at_impl< aux::vector_tag<n_> >
67 template< typename Vector, typename N > struct apply
68 #if !defined(__BORLANDC__)
71 , BOOST_MPL_AUX_VALUE_WKND(N)::value
76 typedef typename v_at<
78 , BOOST_MPL_AUX_VALUE_WKND(N)::value
88 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at_impl
90 template< typename V > struct result_;
93 // to work around ETI, etc.
94 template<> struct v_at_impl<-1>
96 template< typename V > struct result_
104 template< typename T, BOOST_MPL_AUX_NTTP_DECL(long, n_) >
106 : aux::v_at_impl<n_>::template result_<T>
110 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
112 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
116 #endif // BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED