1
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).
6//
7// See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9
10#ifndef BOOST_TT_RANK_HPP_INCLUDED
11#define BOOST_TT_RANK_HPP_INCLUDED
12
13#include <boost/type_traits/integral_constant.hpp>
14
15namespace boost {
16
17#if !defined( __CODEGEARC__ )
18
19namespace detail{
20
21template <class T, std::size_t N>
22struct rank_imp
23{
24 BOOST_STATIC_CONSTANT(std::size_t, value = N);
25};
26#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
27template <class T, std::size_t R, std::size_t N>
28struct rank_imp<T[R], N>
29{
30 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
31};
32
33template <class T, std::size_t R, std::size_t N>
34struct rank_imp<T const[R], N>
35{
36 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
37};
38
39template <class T, std::size_t R, std::size_t N>
40struct rank_imp<T volatile[R], N>
41{
42 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
43};
44
45template <class T, std::size_t R, std::size_t N>
46struct rank_imp<T const volatile[R], N>
47{
48 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
49};
50
51#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
52template <class T, std::size_t N>
53struct rank_imp<T[], N>
54{
55 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
56};
57template <class T, std::size_t N>
58struct rank_imp<T const[], N>
59{
60 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
61};
62template <class T, std::size_t N>
63struct rank_imp<T volatile[], N>
64{
65 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
66};
67template <class T, std::size_t N>
68struct rank_imp<T const volatile[], N>
69{
70 BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
71};
72#endif
73#endif
74}
75
76#endif // !defined( __CODEGEARC__ )
77
78#if defined( __CODEGEARC__ )
79template <class T> struct rank : public integral_constant<std::size_t, __array_rank(T)>{};
80#else
81template <class T> struct rank : public integral_constant<std::size_t, (::boost::detail::rank_imp<T, 0>::value)>{};
82#endif
83
84} // namespace boost
85
86#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
87