定义于头文件
<type_traits>
|
||
template< class T >
struct rank; |
(C++11 起) | |
若 T
是数组类型,则提供等于该数组维数的成员常量 value
。对于任何其他类型, value
为 0 。
目录 |
template< class T >
inline constexpr std::size_t rank_v = rank<T>::value; |
(C++17 起) | |
value
[静态]
|
T 的维数或零 (公开静态成员常量) |
operator std::size_t
|
转换对象为 std::size_t ,返回 value (公开成员函数) |
operator()
(C++14)
|
返回 value (公开成员函数) |
类型 | 定义 |
value_type
|
std::size_t
|
type
|
std::integral_constant<std::size_t, value> |
template<class T> struct rank : public std::integral_constant<std::size_t, 0> {}; template<class T> struct rank<T[]> : public std::integral_constant<std::size_t, rank<T>::value + 1> {}; template<class T, std::size_t N> struct rank<T[N]> : public std::integral_constant<std::size_t, rank<T>::value + 1> {}; |
输出:
3 4 0
(C++11)
|
检查类型是否是数组类型 (类模板) |
(C++11)
|
获取数组类型在指定维度的大小 (类模板) |
(C++11)
|
从给定数组类型移除一个维度 (类模板) |
(C++11)
|
移除数组类型所有维度 (类模板) |