std::pmr::m...::deallocate(3)

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

πŸ’– NAME πŸ’–

okay so bestie, this page is all about std::pmr::memory_resource::deallocate β€” yes, the whole entire name β€” and it's from the C++ Standard Libary (that's their spelling, not mine πŸ’€). it's giving "memory cleanup but make it polymorphic" ✨


🌸 Synopsis 🌸

          void deallocate( void* p,

                           std::size_t bytes,
       (since C++17)

                           std::size_t alignment = alignof(std::max_align_t) );

so like, deallocate deallocates the storage pointed to by p 🫢. but bestie, listen: p shall have been returned by a prior call to allocate(bytes, alignment) on a memory_resource that compares equal to *this, and the storage it points to shall not yet have been deallocated. no cap, those are the rules πŸ‘‘

it's equivalent to do_deallocate(p, bytes, alignment); β€” literally that. that's the whole vibe. periodt πŸ’…


😭 Exceptions 😭

Throws nothing. zero drama, zero mess, she's unbothered πŸ’œ


πŸ‘€ See also πŸ‘€

  • do_deallocate β€” deallocates memory. it's a [virtual] virtual private member function, iykyk 🧚

big kiss to http://cppreference.com and version 2024.06.10 for this std::pmr::m...::deallocate(3) moment β€” mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from