Partilhar via


is_empty Class

Se o tipo é uma classe vazia de testes.

template<class Ty>
    struct is_empty;

Parâmetros

  • Ty
    O tipo de consulta.

Comentários

Uma instância do predicado tipo armazena true se o tipo de Ty é uma classe vazia, de alguma forma ele mantém false.

Exemplo

 

// std_tr1__type_traits__is_empty.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct empty 
    { 
    }; 
 
struct trivial 
    { 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "is_empty<trivial> == " << std::boolalpha 
        << std::is_empty<trivial>::value << std::endl; 
    std::cout << "is_empty<empty> == " << std::boolalpha 
        << std::is_empty<empty>::value << std::endl; 
    std::cout << "is_empty<int> == " << std::boolalpha 
        << std::is_empty<int>::value << std::endl; 
 
    return (0); 
    } 
 
  

Requisitos

Cabeçalho: <type_traits>

Namespace: std

Consulte também

Referência

<type_traits>

Outros recursos

<type_traits> Membros