std::alloca...ts::destroy(3)
π NAME π
std::allocator_traits::destroy - std::allocator_traits::destroy. Yes bestie, the NAME line is literally that twice, itβs giving βsay it backβ energy π. This page lives in the C++ Standard Libary manual (thatβs the manual name, typo and all, weβre not fixing the header π
). The header up top says std::alloca...ts::destroy(3), truncated like that, no cap.
β¨ Synopsis β¨
Defined in header <memory>
template< class T > (since C++11)
static void destroy( Alloc& a, T* p ); (until C++20)
template< class T > (since C++20)
static constexpr void destroy( Alloc& a, T* p );
This function calls the destructor of the object pointed to by p. If possible, it does so by calling a.destroy(p). If thatβs not possible (e.g. Alloc does not have the member function destroy()), then it calls the destructor of *p directly, as p->~T() (until C++20), or std::destroy_at(p) (since C++20). Fallback queen behavior, honestly π.
π Parameters π
aβ allocator to use for destructionpβ pointer to the object being destroyed
π Return value π
(none) β she gives nothing back, and thatβs iconic. No return value, no drama β¨.
π¦ Notes π¦
Because this function provides the automatic fall back to direct call to the destructor, the member function destroy() is an optional Allocator requirement since C++11. So yeah, destroy() is optional, and the fallback has your back π.
π Example π
This section is incomplete.
Reason: no example.
No example bestie, it literally says so π. We move.
π See also π
destroyβ destructs an object in allocated storage (until C++20) (public member function ofstd::allocator<T>)
π Category π
* Todo no exampleβ thatβs the category tag, fr fr. No-example energy confirmed π« .
okay bestie thatβs the whole page π cute sign-off time: this came from http://cppreference.com, version/date 2024.06.10, and the footer title is std::alloca...ts::destroy(3). byeee, go destroy some objects responsibly π«Άβ¨
π¦ 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