Sdílet prostřednictvím


is_function – třída

Testuje, zda typ je typ funkce.

Syntaxe

template <class Ty>
struct is_function;

Parametry

Ty
Typ, na který chcete odeslat dotaz.

Poznámky

Instance predikátu typu obsahuje hodnotu true, pokud typ Ty je typ funkce, jinak obsahuje hodnotu false.

Příklad

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

struct trivial
    {
    int val;
    };

struct functional
    {
    int f();
    };

int main()
    {
    std::cout << "is_function<trivial> == " << std::boolalpha
        << std::is_function<trivial>::value << std::endl;
    std::cout << "is_function<functional> == " << std::boolalpha
        << std::is_function<functional>::value << std::endl;
    std::cout << "is_function<float()> == " << std::boolalpha
        << std::is_function<float()>::value << std::endl;

    return (0);
    }
is_function<trivial> == false
is_function<functional> == false
is_function<float()> == true

Požadavky

Header:<type_traits>

Namespace: std

Viz také

<type_traits>
is_object – třída