STD::POINTER_TRAITS(3cxx)

πŸ’… std::pointer_traits< _Ptr > πŸ’…

πŸŽ€ NAME πŸŽ€

std::pointer_traits< _Ptr > β€” uniform interface to all pointer-like types. This is the libstdc++ (3cxx) manual page, and it's lowkey iconic because it gives pointer-ish things one consistent interface πŸ’–.


✨ SYNOPSIS ✨

#include <memory>

Inherits std::__ptr_traits_impl< _Ptr, _Elt >.

🌸 Public Types 🌸

  • difference_type β€” the type used to represent the difference between two pointers. using difference_type = __detected_or_t< ptrdiff_t, __diff_t, _Ptr >
  • element_type β€” the type pointed to. using element_type = _Elt
  • pointer β€” the pointer type. using pointer = _Ptr
  • rebind β€” a pointer to a different type. template<typename _Up > using rebind = typename __detected_or_t< __replace_first_arg< _Ptr, _Up >, __rebind, _Ptr, _Up >::type

πŸ’… Static Public Member Functions πŸ’…

  • static pointer pointer_to (element_type &__r) β€” obtain a pointer to an object.

🌈 Detailed Description 🌈

template<typename _Ptr>
    struct std::pointer_traits< _Ptr >"Uniform interface to all pointer-like
    types.

Yeah, that quote after _Ptr > is really in the original β€” we're not fixing it, bestie 😭.

Since: C++11

πŸ¦‹ Member Typedef Documentation πŸ¦‹

  • difference_type β€” inherited.
template<typename _Ptr , typename _Elt > using std::__ptr_traits_impl< _Ptr,
    _Elt >::difference_type =  __detected_or_t<ptrdiff_t, __diff_t, _Ptr>
    [inherited]

The type used to represent the difference between two pointers.

  • element_type β€” inherited.
template<typename _Ptr , typename _Elt > using std::__ptr_traits_impl< _Ptr,
    _Elt >::element_type =  _Elt
    [inherited]

The type pointed to.

  • pointer β€” inherited.
template<typename _Ptr , typename _Elt > using std::__ptr_traits_impl< _Ptr,
    _Elt >::pointer =  _Ptr
    [inherited]

The pointer type.

  • rebind β€” inherited.
template<typename _Ptr , typename _Elt > template<typename _Up > using
    std::__ptr_traits_impl< _Ptr, _Elt >::rebind =  typename
    __detected_or_t<__replace_first_arg<_Ptr, _Up>, __rebind, _Ptr,
    _Up>::type [inherited]

A pointer to a different type.

πŸ”₯ Member Function Documentation πŸ”₯

template<typename _Ptr , typename _Elt , bool  = is_void<_Elt>::value>
    static pointer std::__ptr_traits_ptr_to< _Ptr, _Elt, bool >::pointer_to
    (element_type & __r) [inline],  [static],  [inherited]

Obtain a pointer to an object.

  • Parameters: __r β€” a reference to an object of type element_type
  • Returns: pointer::pointer_to(__r)
  • Precondition: pointer::pointer_to(__r) is a valid expression.

πŸ’– Author πŸ’–

Generated automatically by Doxygen for libstdc++ from the source code.


Cute sign-off: source/version = libstdc++; page = std::pointer_traits< _Ptr >(3cxx); date = the original footer doesn't list one, so I'm not inventing a date, bestie πŸ˜ŒπŸ’….

πŸ“¦ where this page comes from