std::add_pointer (3) - Linux Manuals
std::add_pointer: std::add_pointer
NAME
std::add_pointer - std::add_pointer
Synopsis
Defined in header <type_traits>
template< class T > (since C++11)
struct add_pointer;
If T is a reference type, then provides the member typedef type which is a pointer to the referred type.
Otherwise, if T names an object type, a function type that is not cv- or ref-qualified, or a (possibly cv-qualified) void type, provides the member typedef type which is the type T*.
Otherwise (if T is a cv- or ref-qualified function type), provides the member typedef type which is the type T.
Member types
Name Definition
type pointer to T or to the type referenced by T
Helper types
template< class T > (since C++14)
using add_pointer_t = typename add_pointer<T>::type;
Possible implementation
Example
// Run this code
Output:
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
LWG_2101 C++11 std::add_pointer was required to produce Produces cv-/ref-qualified function types themselves.
See also
is_pointer checks if a type is a pointer type
(C++11)
remove_pointer removes a pointer from the given type
(C++11)