std::pointer_traits
From cppreference.com
Defined in header <memory>
|
||
template< class Ptr > struct pointer_traits; |
(1) | (since C++11) |
template< class T > struct pointer_traits<T*>; |
(2) | (since C++11) |
The pointer_traits class template provides the standardized way to access certain properties of pointer-like types.
1) The non-specialized pointer_traits declares the following types:
Contents |
[edit] Member types
Type | Definition |
pointer | Ptr |
element_type | Ptr::element_type if present. Otherwise T if Ptr is a template instantiation Template<T, Args...> |
difference_type | Ptr::difference_type if present, otherwise std::ptrdiff_t |
[edit] Member alias templates
Template | Definition |
template <class U> using rebind | Ptr::rebind<U> if exists, otherwise Tempate<U, Args...> if Ptr is a template instantiation Template<T, Args...> |
[edit] Member functions
[static] |
obtains a dereferencable pointer to its argument (public static member function) |
2) A specialization is provided for pointer types, T*, which declares the following types
[edit] Member types
Type | Definition |
pointer | T* |
element_type | T |
difference_type | std::ptrdiff_t |
[edit] Member alias templates
Template | Definition |
template< class U > using rebind | U* |
[edit] Member functions
[static] |
obtains a dereferencable pointer to its argument} (public static member function) |
[edit] See also
(C++11) |
provides information about allocator types (class template) |
(C++11) |
obtains actual address of an object, even if the & operator is overloaded (function template) |