Skip to content

Latest commit

 

History

History
75 lines (56 loc) · 1.43 KB

is-function-class.md

File metadata and controls

75 lines (56 loc) · 1.43 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: is_function Class
is_function Class
02/21/2019
type_traits/std::is_function
is_function class
is_function
e5c0dbcd-829b-415f-853f-8c5be47c5040

is_function Class

Tests if type is a function type.

Syntax

template <class Ty>
struct is_function;

Parameters

Ty
The type to query.

Remarks

An instance of the type predicate holds true if the type Ty is a function type, otherwise it holds false.

Example

// 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

Requirements

Header: <type_traits>

Namespace: std

See also

<type_traits>
is_object Class