STD::POINTER_TRAITS(3)

πŸ’– std::pointer_traits< _Ptr >(3) β€” Library Functions Manual πŸ’–

okay bestie, welcome to the glow-up zone ✨ this is a page from the Library Functions Manual, and it's all about std::pointer_traits< _Ptr >, which is literally the "everyone's welcome here" friend group for pointer-ish types 🫢


🌸 NAME 🌸

std::pointer_traits< _Ptr > β€” the uniform interface to all pointer-like types. no cap, all of them πŸ’…


✨ SYNOPSIS ✨

#include <memory>

πŸŽ€ Public Types πŸŽ€

  • using difference_type β€” the type that represents the difference between two pointers. it's giving "how far apart are we, emotionally" 😭
  • using element_type β€” the type that's being pointed to πŸ‘‰
  • using pointer β€” the pointer type itself, the main character πŸ‘‘
  • template<typename _Up> using rebind β€” a pointer to a different 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. periodt.

Since β€” C++11 ⭐ (yes she's been iconic since 2011, respect the elders)


πŸ“ Member Typedef Documentation πŸ“

all of these are marked [inherited], because sharing is caring πŸ’•

  • template<typename _Ptr, typename _Elt> using std::__ptr_traits_impl< _Ptr, _Elt >::difference_type [inherited] β€” the type used to represent the difference between two pointers. two pointers, one difference_type, it's giving distance ✌️
  • template<typename _Ptr, typename _Elt> using std::__ptr_traits_impl< _Ptr, _Elt >::element_type [inherited] β€” the type pointed to 🎯
  • template<typename _Ptr, typename _Elt> using std::__ptr_traits_impl< _Ptr, _Elt >::pointer [inherited] β€” the pointer type πŸ’«
  • template<typename _Ptr, typename _Elt> template<typename _Up> using std::__ptr_traits_impl< _Ptr, _Elt >::rebind [inherited] β€” a pointer to a different type. rebranding era, lowkey obsessed πŸ™ˆ

πŸ”₯ Member Function Documentation πŸ”₯

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

Obtain a pointer to an object. that's the whole job bestie, and she does it flawlessly πŸ’…

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.
⚠️ listen up: that precondition is not a vibe check you can skip. if pointer::pointer_to(__r) isn't a valid expression, we're not doing this. fr fr. πŸ’€

🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code. not a human, just a very efficient queen πŸ‘‘


and that's the page, bestie!! this whole thing is served fresh from the libstdc++ manual, so if you ever forget who wrote it β€” it's libstdc++, and it's been that girl the entire time πŸ’–πŸŽ€πŸ¦‹ keep slaying, and go read your headers. mwah πŸ’‹

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 43: libstdc++-docs 15.2.1-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 43: libstdc++-docs 15.3.1-1.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms