STD::DEFAULT_DELETE(3cxx)

πŸ’– std::default_delete< _Tp > πŸ’–

okay so bestie, welcome to the std::default_delete< _Tp > page β€” this is the libstdc++ manpage for it, and we're gonna get you comfy with it, no cap 🫢


✨ SYNOPSIS ✨

First things first, you gotta pull it in:

#include <memory>

πŸŽ€ Public Member Functions

  • constexpr default_delete () noexcept=default β€” the default constructor. yes queen, it's just sitting there being defaulted ✨ (described below as "Default constructor.")
  • template<typename _Up , typename = _Require<is_convertible<_Up*, _Tp*>>> constexpr default_delete (const default_delete< _Up > &) noexcept β€” the converting constructor. it lets you convert from a deleter made for another type (_Up) but only if _Up* is convertible to _Tp* β€” the _Require is doing the gatekeeping πŸ’… (described below as "Converting constructor.")
  • constexpr void operator() (_Tp *__ptr) const β€” calls delete __ptr, that's literally the whole job. iconic.

🌸 Detailed Description 🌸

template<typename _Tp>
struct std::default_delete< _Tp >

it's giving "Primary template of default_delete, used by unique_ptr for single objects" πŸ’€ like, this is the little guy that unique_ptr uses under the hood for single objects. main character energy fr fr πŸ‘‘

⭐ Since

C++11

(the way this is old enough to be a classic but still slays 😭)


πŸ’œ Constructor & Destructor Documentation πŸ’œ

πŸ¦‹ template<typename _Tp > constexpr std::default_delete< _Tp >::default_delete () [constexpr], [default], [noexcept]

Default constructor. that's it. that's the whole thing. it's constexpr, it's default, it's noexcept β€” a triple threat, we love to see it ✨

πŸ¦‹ template<typename _Tp > template<typename _Up , typename = _Require<is_convertible<_Up*, _Tp*>>> constexpr std::default_delete< _Tp >::default_delete (const default_delete< _Up > &) [inline], [constexpr], [noexcept]

Converting constructor. bestie read carefully: it "Allows conversion from a deleter for objects of another type, _Up, only if _Up* is convertible to _Tp*." so like, it's not free-for-all conversion, the types gotta actually be compatible or it just won't let you in πŸ™ˆ note the [inline], [constexpr] and [noexcept] β€” yes all three, she's versatile πŸŽ€


πŸ”₯ Member Function Documentation πŸ”₯

🌈 template<typename _Tp > constexpr void std::default_delete< _Tp >::operator() (_Tp * __ptr) const [inline], [constexpr]

Calls delete __ptr

that's the vibe. you hand it __ptr, it deletes it. [inline] and [constexpr] on deck. periodt πŸ’…


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. (so like, a robot wrote this, not me, don't come for me 😭)


πŸ’– that's the whole page bestie β€” no extra lore, no hidden flags, just the deleter doing its deleter thing. iykyk 🧚

and that's a wrap on this libstdc++ page for std::default_delete< _Tp >(3cxx) πŸ“ thanks for reading babe, go delete some pointers (responsibly) πŸ’œβœ¨

πŸ“¦ where this page comes from