is_empty — Klasa
Sprawdza, czy typ jest pustą klasą.
Składnia
template <class Ty>
struct is_empty;
Parametry
Ty
Typ do zapytania.
Uwagi
Wystąpienie predykatu typu ma wartość true, jeśli typ Ty jest pustą klasą, w przeciwnym razie zawiera wartość false.
Przykład
// std__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);
}
is_empty<trivial> == false
is_empty<empty> == true
is_empty<int> == false
Wymagania
Nagłówek:<type_traits>
Przestrzeń nazw: std