extent Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at extent Class.

Gets an array dimension.

template <class Ty, unsigned I = 0>  
struct extent;  

Parameters

Ty
The type to query.

I
The array bound to query.

If Ty is an array type that has at least I dimensions, the type query holds the number of elements in the dimension specified by I. If Ty is not an array type or its rank is less than I, or if I is zero and Ty is of type "array of unknown bound of U", the type query holds the value 0.

// std_tr1__type_traits__extent.cpp   
// compile with: /EHsc   
#include <type_traits>   
#include <iostream>   
  
int main()   
    {   
    std::cout << "extent 0 == "   
        << std::extent<int[5][10]>::value << std::endl;   
    std::cout << "extent 1 == "   
        << std::extent<int[5][10], 1>::value << std::endl;   
  
    return (0);   
    }  
  

extent 0 == 5  
extent 1 == 10  

Header: <type_traits>

Namespace: std

<type_traits>
remove_all_extents Class
remove_extent Class

Show: