std::allocator::destroy(3)
π
std::allocator::destroy (3) β C++ Standard Libary π
okay bestie, welcome to the destructor corner of the C++ Standard Libary. This page is for std::allocator::destroy, and itβs lowkey iconic in a βplease clean up after yourselfβ way. π
πΈ NAME πΈ
std::allocator::destroy β std::allocator::destroy
yep, the name is the name, no notes π
β¨ Synopsis β¨
The synopsis is literally:
Defined in header <memory>
void destroy( pointer p ); (1) (until C++11)
template< class U > (since C++11)
void destroy( U* p ); (2) (deprecated in C++17)
(removed in C++20)
It calls the destructor of the object pointed to by p. bestie, thatβs the whole vibe. π«Ά
- Calls
p->~T(). - Calls
p->~U().
heads up: overload 2 is deprecated in C++17 and removed in C++20 β so if youβre on C++20+, that one is not invited to the function-call party anymore. π
π Parameters π
pβ pointer to the object that is going to be destroyed. itβs giving βyou break it, you clean itβ energy. π§
π Return value π
(none) β no return value, bestie. it just handles the destructor business and dips. π
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 400 - Applied to:
C++98 - Behavior as published:
pwas cast toT*, which is the type ofp - Correct behavior: removed the redundant cast
slay, a little cleanup for the history books. π§Ήβ¨
π¦ See also π¦
destroyβ destructs an object stored in the allocated storage[static](function template)
okay bestie, thatβs the whole page β source/version: http://cppreference.com, dated 2024.06.10 π periodt. π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms