File indexing completed on 2025-01-18 09:53:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_TT_EXTENT_HPP_INCLUDED
0011 #define BOOST_TT_EXTENT_HPP_INCLUDED
0012
0013 #include <cstddef> // size_t
0014 #include <boost/type_traits/integral_constant.hpp>
0015 #include <boost/detail/workaround.hpp>
0016
0017 namespace boost {
0018
0019 namespace detail{
0020
0021 #if defined( BOOST_CODEGEARC )
0022
0023 template < typename T, std::size_t N >
0024 struct extent_imp {
0025 static const std::size_t value = __array_extent(T, N);
0026 };
0027
0028 #else
0029
0030 template <class T, std::size_t N>
0031 struct extent_imp
0032 {
0033 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
0034 };
0035 #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
0036 template <class T, std::size_t R, std::size_t N>
0037 struct extent_imp<T[R], N>
0038 {
0039 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0040 };
0041
0042 template <class T, std::size_t R, std::size_t N>
0043 struct extent_imp<T const[R], N>
0044 {
0045 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0046 };
0047
0048 template <class T, std::size_t R, std::size_t N>
0049 struct extent_imp<T volatile[R], N>
0050 {
0051 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0052 };
0053
0054 template <class T, std::size_t R, std::size_t N>
0055 struct extent_imp<T const volatile[R], N>
0056 {
0057 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0058 };
0059
0060 template <class T, std::size_t R>
0061 struct extent_imp<T[R],0>
0062 {
0063 BOOST_STATIC_CONSTANT(std::size_t, value = R);
0064 };
0065
0066 template <class T, std::size_t R>
0067 struct extent_imp<T const[R], 0>
0068 {
0069 BOOST_STATIC_CONSTANT(std::size_t, value = R);
0070 };
0071
0072 template <class T, std::size_t R>
0073 struct extent_imp<T volatile[R], 0>
0074 {
0075 BOOST_STATIC_CONSTANT(std::size_t, value = R);
0076 };
0077
0078 template <class T, std::size_t R>
0079 struct extent_imp<T const volatile[R], 0>
0080 {
0081 BOOST_STATIC_CONSTANT(std::size_t, value = R);
0082 };
0083
0084 #if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) && !defined(__MWERKS__)
0085 template <class T, std::size_t N>
0086 struct extent_imp<T[], N>
0087 {
0088 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0089 };
0090 template <class T, std::size_t N>
0091 struct extent_imp<T const[], N>
0092 {
0093 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0094 };
0095 template <class T, std::size_t N>
0096 struct extent_imp<T volatile[], N>
0097 {
0098 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0099 };
0100 template <class T, std::size_t N>
0101 struct extent_imp<T const volatile[], N>
0102 {
0103 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
0104 };
0105 template <class T>
0106 struct extent_imp<T[], 0>
0107 {
0108 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
0109 };
0110 template <class T>
0111 struct extent_imp<T const[], 0>
0112 {
0113 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
0114 };
0115 template <class T>
0116 struct extent_imp<T volatile[], 0>
0117 {
0118 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
0119 };
0120 template <class T>
0121 struct extent_imp<T const volatile[], 0>
0122 {
0123 BOOST_STATIC_CONSTANT(std::size_t, value = 0);
0124 };
0125 #endif
0126 #endif
0127
0128 #endif
0129 }
0130
0131 template <class T, std::size_t N = 0>
0132 struct extent
0133 : public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value>
0134 {
0135 };
0136
0137 }
0138
0139 #endif