std::pmr::p...locate_bytes(3)

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

πŸ’– std::pmr::p...locate_bytes(3) β€” C++ Standard Libary πŸ’–

okay bestie, welcome to the C++ Standard Libary corner of the manualverse πŸ’… We're reading std::pmr::p...locate_bytes(3), and the p...locate is just the truncation being dramatic. The actual function is std::pmr::polymorphic_allocator::deallocate_bytes, and yes she has main character energy.


🌸 NAME 🌸

std::pmr::polymorphic_allocator::deallocate_bytes β€” std::pmr::polymorphic_allocator::deallocate_bytes.

Literally the same name twice, and honestly? iconic 🫢

✨ Synopsis ✨

The signature, served fresh:

void deallocate_bytes( void* p,
                       std::size_t nbytes,
                       std::size_t alignment = alignof(std::max_align_t) );

Tagged (since C++20), so set your mental compiler to C++20 mode ⭐

Okay so deallocate_bytes deallocates the storage pointed to by p, and that p must have been allocated from a std::pmr::memory_resource x that compares equal to *resource(), using x.allocate(nbytes, alignment) β€” typically through a call to allocate_bytes(nbytes, alignment).

It's equivalent to:

resource()->deallocate(p, nbytes, alignment);

πŸŽ€ Parameters πŸŽ€

  • p β€” pointer to memory to deallocate. bye-bye, memory πŸ‘‹
  • nbytes β€” the number of bytes originally allocated.
  • alignment β€” the alignment originally allocated.

πŸ’€ Exceptions πŸ’€

Throws nothing. That's it. no drama, no surprise throws, just peace and quiet πŸ’…

πŸ¦‹ Notes πŸ¦‹

This function was introduced for use with the fully-specialized allocator std::pmr::polymorphic_allocator<>, but it may be useful in any specialization. cute versatility, no cap ✨

🌈 See Also 🌈

  • deallocate_object (C++20) β€” frees raw memory obtained by allocate_object (public member function).
  • delete_object (C++20) β€” destroys and deallocates an object (public member function).
  • deallocate [static] β€” deallocates storage using the allocator (public static member function of std::allocator_traits<Alloc>).
  • deallocate β€” deallocates memory (public member function of std::pmr::memory_resource).

kisses bestie, this page came from http://cppreference.com, dated 2024.06.10, and it's the std::pmr::p...locate_bytes(3) manual page. mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from