2 // (C) Copyright John Maddock 2005.
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
10 #ifndef BOOST_TT_EXTENT_HPP_INCLUDED
11 #define BOOST_TT_EXTENT_HPP_INCLUDED
13 // should be the last #include
14 #include <boost/type_traits/detail/size_t_trait_def.hpp>
20 #if defined( __CODEGEARC__ )
21 // wrap the impl as main trait provides additional MPL lambda support
22 template < typename T
, std::size_t N
>
24 static const std::size_t value
= __array_extent(T
, N
);
29 template <class T
, std::size_t N
>
32 BOOST_STATIC_CONSTANT(std::size_t, value
= 0);
34 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
35 template <class T
, std::size_t R
, std::size_t N
>
36 struct extent_imp
<T
[R
], N
>
38 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
41 template <class T
, std::size_t R
, std::size_t N
>
42 struct extent_imp
<T
const[R
], N
>
44 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
47 template <class T
, std::size_t R
, std::size_t N
>
48 struct extent_imp
<T
volatile[R
], N
>
50 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
53 template <class T
, std::size_t R
, std::size_t N
>
54 struct extent_imp
<T
const volatile[R
], N
>
56 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
59 template <class T
, std::size_t R
>
60 struct extent_imp
<T
[R
],0>
62 BOOST_STATIC_CONSTANT(std::size_t, value
= R
);
65 template <class T
, std::size_t R
>
66 struct extent_imp
<T
const[R
], 0>
68 BOOST_STATIC_CONSTANT(std::size_t, value
= R
);
71 template <class T
, std::size_t R
>
72 struct extent_imp
<T
volatile[R
], 0>
74 BOOST_STATIC_CONSTANT(std::size_t, value
= R
);
77 template <class T
, std::size_t R
>
78 struct extent_imp
<T
const volatile[R
], 0>
80 BOOST_STATIC_CONSTANT(std::size_t, value
= R
);
83 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) && !defined(__MWERKS__)
84 template <class T
, std::size_t N
>
85 struct extent_imp
<T
[], N
>
87 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
89 template <class T
, std::size_t N
>
90 struct extent_imp
<T
const[], N
>
92 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
94 template <class T
, std::size_t N
>
95 struct extent_imp
<T
volatile[], N
>
97 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
99 template <class T
, std::size_t N
>
100 struct extent_imp
<T
const volatile[], N
>
102 BOOST_STATIC_CONSTANT(std::size_t, value
= (::boost::detail::extent_imp
<T
, N
-1>::value
));
105 struct extent_imp
<T
[], 0>
107 BOOST_STATIC_CONSTANT(std::size_t, value
= 0);
110 struct extent_imp
<T
const[], 0>
112 BOOST_STATIC_CONSTANT(std::size_t, value
= 0);
115 struct extent_imp
<T
volatile[], 0>
117 BOOST_STATIC_CONSTANT(std::size_t, value
= 0);
120 struct extent_imp
<T
const volatile[], 0>
122 BOOST_STATIC_CONSTANT(std::size_t, value
= 0);
127 #endif // non-CodeGear implementation
130 template <class T
, std::size_t N
= 0>
132 : public ::boost::integral_constant
<std::size_t, ::boost::detail::extent_imp
<T
,N
>::value
>
134 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
135 typedef ::boost::integral_constant
<std::size_t, ::boost::detail::extent_imp
<T
,N
>::value
> base_
;
138 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent
,(T
))
143 #include <boost/type_traits/detail/size_t_trait_undef.hpp>
145 #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED