Share via


is_array Class

Tests if type is array.

template<class Ty>
    struct is_array;

Parameters

  • Ty
    The type to query.

Remarks

An instance of the type predicate holds true if the type Ty is an array type, otherwise it holds false.

Example

 

// std_tr1__type_traits__is_array.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "is_array<trivial> == " << std::boolalpha 
        << std::tr1::is_array<trivial>::value << std::endl; 
    std::cout << "is_array<int> == " << std::boolalpha 
        << std::tr1::is_array<int>::value << std::endl; 
    std::cout << "is_array<int[5]> == " << std::boolalpha 
        << std::tr1::is_array<int[5]>::value << std::endl; 
 
    return (0); 
    } 
 

is_array<trivial> == false is_array<int> == false is_array<int[5]> == true

Requirements

Header: <type_traits>

Namespace: std::tr1

See Also

Reference

<type_traits>

extent Class

rank Class