]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | Copyright 2007 John Maddock. | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:rank rank] | |
9 | template <class T> | |
10 | struct rank : public __integral_constant<std::size_t, RANK(T)> {}; | |
11 | ||
12 | __inherit Class template rank inherits from `__integral_constant<std::size_t, RANK(T)>`, | |
13 | where `RANK(T)` is the number of array dimensions in type `T`. | |
14 | ||
15 | If `T` is not a (built-in) array type, then `RANK(T)` is zero. | |
16 | ||
17 | [all_compilers] | |
18 | ||
19 | __header ` #include <boost/type_traits/rank.hpp>` or ` #include <boost/type_traits.hpp>` | |
20 | ||
21 | __examples | |
22 | ||
23 | [:`rank<int[]>` inherits from `__integral_constant<std::size_t, 1>`.] | |
24 | ||
25 | [:`rank<double[2][3][4]>::type` is the type `__integral_constant<std::size_t, 3>`.] | |
26 | ||
27 | [:`rank<int[1]>::value` is an integral constant | |
28 | expression that evaluates to /1/.] | |
29 | ||
30 | [:`rank<int[][2]>::value` is an integral constant | |
31 | expression that evaluates to /2/.] | |
32 | ||
33 | [:`rank<int*>::value` is an integral constant | |
34 | expression that evaluates to /0/.] | |
35 | ||
36 | [:`rank<boost::array<int, 3> >::value` is an integral constant | |
37 | expression that evaluates to /0/: `boost::array` is a class type and [*not an array type]!] | |
38 | ||
39 | [:`rank<T>::value_type` is the type `std::size_t`.] | |
40 | ||
41 | [endsect] | |
42 |