remove_extent Class


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

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

Makes element type from array type.

template <class T>  
struct remove_extent;  
template <class T>  
using remove_extent_t = typename remove_extent<T>::type;  


The type to modify.

An instance of remove_extent<T> holds a modified-type that is T1 when T is of the form T1[N], otherwise T.

#include <type_traits>   
#include <iostream>   
int main()   
    std::cout << "remove_extent_t<int> == "  
        << typeid(std::remove_extent_t<int>).name()  
        << std::endl;T  
    std::cout << "remove_extent_t<int[5]> == "  
        << typeid(std::remove_extent_t<int[5]>).name()  
        << std::endl;T  
    std::cout << "remove_extent_t<int[5][10]> == "  
        << typeid(std::remove_extent_t<int[5][10]>).name()  
        << std::endl;   
    return (0);   

remove_extent_t<int> == int  
remove_extent_t<int[5]> == int  
remove_extent_t<int[5][10]> == int [10]  

Header: <type_traits>

Namespace: std

remove_all_extents Class