Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 1.73 KB

is-object-class.md

File metadata and controls

81 lines (62 loc) · 1.73 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: is_object Class
is_object Class
11/04/2016
type_traits/std::is_object
is_object class
is_object
b452ceea-5676-488f-925b-ab881126c387

is_object Class

Tests if type is an object type.

Syntax

template <class Ty>
struct is_object;

Parameters

Ty
The type to query.

Remarks

An instance of the type predicate holds false if the type Ty is a reference type, a function type, or void, or a cv-qualified form of one of them, otherwise holds true.

Example

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

struct trivial
    {
    int val;
    };

struct functional
    {
    int f();
    };

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

    return (0);
    }
is_object<trivial> == true
is_object<functional> == true
is_object<trivial&> == false
is_object<float()> == false
is_object<void> == false

Requirements

Header: <type_traits>

Namespace: std

See also

<type_traits>
is_function Class