std::pmr::p...::deallocate(3)
π NAME π
okay so we're looking at std::pmr::p...::deallocate(3) β aka std::pmr::polymorphic_allocator::deallocate β from the C++ Standard Libary manual (yes, that spelling is literally in the header π). It's the deallocation girlie of the polymorphic_allocator family, and she is here to say bye to memory the right way π
.
β¨ Synopsis β¨
The signature is giving very concise, very C++17-core:
void deallocate( T* p, std::size_t n );
(since C++17) β periodt, we love a modern king π.
πΈ DESCRIPTION πΈ
So bestie, deallocate deallocates the storage pointed to by p π«Ά. But plot twist: p must have been allocated from a std::pmr::memory_resource x that compares equal to *resource() using x.allocate(n * sizeof(T), alignof(T)). no cap, that's the whole vibe check for p π₯.
It's equivalent to this exact little line of business:
this->resource()->deallocate(p, n * sizeof(T), alignof(T));
highkey just forwarding the whole thing to the resource and letting it handle the actual deallocation energy π§β¨.
π PARAMETERS π
pβ pointer to memory to deallocate π«Άnβ the number of objects originally allocated π
π EXCEPTIONS π
Throws nothing. not a single thing. zero drama, zero chaos, absolutely iconic πβ¨.
π¦ SEE ALSO π¦
deallocate_bytesβ free raw memory obtained fromallocate_bytes(C++20) (public member function)deallocate_objectβ frees raw memory obtained byallocate_object(C++20) (public member function)delete_objectβ destroys and deallocates an object (C++20) (public member function)deallocate[static] β deallocates storage using the allocator (public static member function ofstd::allocator_traits<Alloc>)deallocateβ deallocates memory (public member function ofstd::pmr::memory_resource)
mwah π β source/version: http://cppreference.com, dated 2024.06.10. that's the whole page, bestie, go forth and deallocate 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