Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Hiermee haalt u het aantal matrixdimensies op.
Syntaxis
template <class Type>
struct rank;
Sjabloonparameters
Type
Het type dat u wilt opvragen.
Opmerkingen
De typequery bevat de waarde van het aantal dimensies van het matrixtype Typeof 0 als Type dit geen matrixtype is.
Example
// std__type_traits__rank.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
int main()
{
std::cout << "rank<int> == "
<< std::rank<int>::value << std::endl;
std::cout << "rank<int[5]> == "
<< std::rank<int[5]>::value << std::endl;
std::cout << "rank<int[5][10]> == "
<< std::rank<int[5][10]>::value << std::endl;
int single_dim_array[]{ 1, 2, 3 };
int double_dim_array[2][1]{ { 4 }, { 5 } };
std::cout << "\nrank<decltype(single_dim_array)> == "
<< std::rank<decltype(single_dim_array)>::value << std::endl;
std::cout << "rank<decltype(double_dim_array)> == "
<< std::rank<decltype(double_dim_array)>::value << std::endl;
}
rank<int> == 0
rank<int[5]> == 1
rank<int[5][10]> == 2
rank<decltype(single_dim_array)> == 1
rank<decltype(double_dim_array)> == 2
Requirements
Rubriek:<type_traits>
Namespace:std