std::undeclare_reachable(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::undeclare_reachable(3) β€” C++ Standard Libary πŸ’…

okay bestie, welcome to the std::undeclare_reachable(3) page from the C++ Standard Libary β€” yes, that's the manual name, and yes we're doing this together πŸ’–

πŸ’– NAME πŸ’–

std::undeclare_reachable β€” std::undeclare_reachable. iconic, self-titled, no notes ✨

🌸 Synopsis 🌸

Defined in header <memory> ✨

template< class T >              (since C++11)
T* undeclare_reachable( T* p );  (removed in C++23)

okay so this one removes the reachable status of the object referenced by the pointer p, but only if that status was previously set by std::declare_reachable. 🫢

and listen: if the object was declared reachable multiple times, it takes an equal number of calls to undeclare_reachable to remove that status. no shortcuts, bestie β€” the count has to match πŸ”₯

once the object is not declared reachable and has no pointers referencing it, it may be reclaimed by a garbage collector or reported as a leak by a leak detector. so like, after that it's out of the reachable club πŸ’€

heads up: the synopsis says (removed in C++23), so this one is giving legacy era πŸ™ˆ

πŸŽ€ Parameters πŸŽ€

  • p β€” a pointer to an object previously declared reachable and not destructed since then πŸ’–

⭐ Return value ⭐

A safely-derived copy of p. that's it, that's the vibe 🫢

πŸ¦‹ Exceptions πŸ¦‹

Throws nothing. literally nothing, no cap 😌

🌈 See also 🌈

  • declare_reachable β€” declares that an object can not be recycled (C++11) (function) (removed in C++23) πŸ‘‘

okay that's the whole page, bestie β€” source/version http://cppreference.com, dated 2024.06.10, and yes it's std::undeclare_reachable(3), mwah πŸ’‹

πŸ“¦ where this page comes from