Udostępnij za pośrednictwem


is_fundamental — Klasa

Sprawdza, czy typ ma wartość void lub arytmetyczną.

Składnia

template <class Ty>
struct is_fundamental;

Parametry

Ty
Typ do zapytania.

Uwagi

Wystąpienie predykatu typu ma wartość true, jeśli typ Ty jest typem podstawowym, czyli voidtypem całkowitym, typem zmiennoprzecinkowym lub formą cv-qualified jednego z nich, w przeciwnym razie zawiera wartość false.

Przykład

// std__type_traits__is_fundamental.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>

struct trivial
    {
    int val;
    };

int main()
    {
    std::cout << "is_fundamental<trivial> == " << std::boolalpha
        << std::is_fundamental<trivial>::value << std::endl;
    std::cout << "is_fundamental<int> == " << std::boolalpha
        << std::is_fundamental<int>::value << std::endl;
    std::cout << "is_fundamental<const float> == " << std::boolalpha
        << std::is_fundamental<const float>::value << std::endl;
    std::cout << "is_fundamental<void> == " << std::boolalpha
        << std::is_fundamental<void>::value << std::endl;

    return (0);
    }
is_fundamental<trivial> == false
is_fundamental<int> == true
is_fundamental<const float> == true
is_fundamental<void> == true

Wymagania

Nagłówek:<type_traits>

Przestrzeń nazw: std

Zobacz też

<type_traits>
is_compound, klasa