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 template <class T, std::size_t N>
23 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
25 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
26 template <class T, std::size_t R, std::size_t N>
27 struct extent_imp<T[R], N>
29 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
32 template <class T, std::size_t R, std::size_t N>
33 struct extent_imp<T const[R], N>
35 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
38 template <class T, std::size_t R, std::size_t N>
39 struct extent_imp<T volatile[R], N>
41 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
44 template <class T, std::size_t R, std::size_t N>
45 struct extent_imp<T const volatile[R], N>
47 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
50 template <class T, std::size_t R>
51 struct extent_imp<T[R],0>
53 BOOST_STATIC_CONSTANT(std::size_t, value = R);
56 template <class T, std::size_t R>
57 struct extent_imp<T const[R], 0>
59 BOOST_STATIC_CONSTANT(std::size_t, value = R);
62 template <class T, std::size_t R>
63 struct extent_imp<T volatile[R], 0>
65 BOOST_STATIC_CONSTANT(std::size_t, value = R);
68 template <class T, std::size_t R>
69 struct extent_imp<T const volatile[R], 0>
71 BOOST_STATIC_CONSTANT(std::size_t, value = R);
74 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) && !defined(__MWERKS__)
75 template <class T, std::size_t N>
76 struct extent_imp<T[], N>
78 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
80 template <class T, std::size_t N>
81 struct extent_imp<T const[], N>
83 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
85 template <class T, std::size_t N>
86 struct extent_imp<T volatile[], N>
88 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
90 template <class T, std::size_t N>
91 struct extent_imp<T const volatile[], N>
93 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
96 struct extent_imp<T[], 0>
98 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
101 struct extent_imp<T const[], 0>
103 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
106 struct extent_imp<T volatile[], 0>
108 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
111 struct extent_imp<T const volatile[], 0>
113 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
119 template <class T, std::size_t N = 0>
121 : public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value>
123 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
124 typedef ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value> base_;
127 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent,(T))
132 #include <boost/type_traits/detail/size_t_trait_undef.hpp>
134 #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED