次の方法で共有


is_array Class

 

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

Tests if type is array.

Syntax

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::is_array<trivial>::value << std::endl;   
    std::cout << "is_array<int> == " << std::boolalpha   
        << std::is_array<int>::value << std::endl;   
    std::cout << "is_array<int[5]> == " << std::boolalpha   
        << std::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

See Also

<type_traits>
extent Class
rank Class