]> git.donarmstrong.com Git - rsem.git/blob - boost/mpl/vector/aux_/at.hpp
Updated boost to v1.55.0
[rsem.git] / boost / mpl / vector / aux_ / at.hpp
1
2 #ifndef BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
3 #define BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED
4
5 // Copyright Aleksey Gurtovoy 2000-2004
6 //
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)
10 //
11 // See http://www.boost.org/libs/mpl for documentation.
12
13 // $Id: at.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
14 // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $
15 // $Revision: 49267 $
16
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>
26
27 namespace boost { namespace mpl {
28
29 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
30
31 template< typename Vector, long n_ >
32 struct v_at_impl
33 {
34     typedef long_< (Vector::lower_bound_::value + n_) > index_;
35     typedef __typeof__( Vector::item_(index_()) ) type;
36 };
37
38
39 template< typename Vector, long n_ >
40 struct v_at
41     : aux::wrapped_type< typename v_at_impl<Vector,n_>::type >
42 {
43 };
44
45 template<>
46 struct at_impl< aux::vector_tag >
47 {
48     template< typename Vector, typename N > struct apply
49         : v_at<
50               Vector
51             , BOOST_MPL_AUX_VALUE_WKND(N)::value
52             >
53     {
54     };
55 };
56
57 #else
58
59 #   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
60     && !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC)
61
62 template< typename Vector, BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at;
63
64 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) >
65 struct at_impl< aux::vector_tag<n_> >
66 {
67     template< typename Vector, typename N > struct apply
68 #if !defined(__BORLANDC__)
69         : v_at<
70               Vector
71             , BOOST_MPL_AUX_VALUE_WKND(N)::value
72             >
73     {
74 #else
75     {
76         typedef typename v_at<
77               Vector
78             , BOOST_MPL_AUX_VALUE_WKND(N)::value
79             >::type type;
80 #endif
81     };
82 };
83
84 #   else
85
86 namespace aux {
87
88 template< BOOST_MPL_AUX_NTTP_DECL(long, n_) > struct v_at_impl
89 {
90     template< typename V > struct result_;
91 };
92
93 // to work around ETI, etc.
94 template<> struct v_at_impl<-1>
95 {
96     template< typename V > struct result_
97     {
98         typedef void_ type;
99     };
100 };
101
102 } // namespace aux
103
104 template< typename T, BOOST_MPL_AUX_NTTP_DECL(long, n_) >
105 struct v_at
106     : aux::v_at_impl<n_>::template result_<T>
107 {
108 };
109
110 #   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
111
112 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
113
114 }}
115
116 #endif // BOOST_MPL_VECTOR_AUX_AT_HPP_INCLUDED