Skip to content

Latest commit

 

History

History
77 lines (59 loc) · 1.92 KB

is-pointer-class.md

File metadata and controls

77 lines (59 loc) · 1.92 KB
descriptiontitlems.datef1_keywordshelpviewer_keywordsms.assetid
Learn more about: is_pointer Class
is_pointer Class
11/04/2016
type_traits/std::is_pointer
is_pointer class
is_pointer
44e0a403-7241-4e0a-8922-32877bcb9a4c

is_pointer Class

Tests if type is a pointer.

Syntax

template <classTy> structis_pointer;

Parameters

Ty
The type to query.

Remarks

An instance of the type predicate holds true if the type Ty is a pointer to void, a pointer to an object, or a pointer to a function, or a cv-qualified form of one of them, otherwise it holds false. Note that is_pointer holds false if Ty is a pointer to member or a pointer to member function.

Example

// std__type_traits__is_pointer.cpp// compile with: /EHsc #include<type_traits> #include<iostream>structtrivial { int val; }; intmain() { std::cout << "is_pointer<trivial> == " << std::boolalpha << std::is_pointer<trivial>::value << std::endl; std::cout << "is_pointer<int trivial::*> == " << std::boolalpha << std::is_pointer<int trivial::*>::value << std::endl; std::cout << "is_pointer<trivial *> == " << std::boolalpha << std::is_pointer<trivial *>::value << std::endl; std::cout << "is_pointer<int> == " << std::boolalpha << std::is_pointer<int>::value << std::endl; std::cout << "is_pointer<int *> == " << std::boolalpha << std::is_pointer<int *>::value << std::endl; return (0); }
is_pointer<trivial> == false is_pointer<int trivial::*> == false is_pointer<trivial *> == true is_pointer<int> == false is_pointer<int *> == true 

Requirements

Header: <type_traits>

Namespace: std

See also

<type_traits>
is_member_pointer Class
is_reference Class

close