std::experi...ce::allocate(3)

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

πŸŽ€ std::experi...ce::allocate(3) πŸŽ€

okay so bestie, this page is from the C++ Standard Libary manual β€” yes, β€œLibary,” exactly like that, iykyk β€” and we’re about to make std::experimental::pmr::memory_resource::allocate make sense. no cap. ✨


✨ NAME ✨

std::experimental::pmr::memory_resource::allocate β€” std::experimental::pmr::memory_resource::allocate. yep, the function and the page have the exact same name, and honestly? iconic πŸ’…


πŸ¦‹ Synopsis πŸ¦‹

void* allocate( std::size_t bytes, std::size_t alignment   (library
fundamentals TS)
= alignof(std::max_align_t) );

This one is the (library fundamentals TS) version, periodt.

It allocates storage with a size of at least bytes bytes. the returned storage is aligned to the specified alignment if that alignment is supported, and to alignof(std::max_align_t) otherwise. 🌸

It’s equivalent to return do_allocate(bytes, alignment);. literally that. 🫢


😭 Exceptions 😭

It throws an exception if storage of the requested size and alignment cannot be obtained. no storage? no vibes. it throws. πŸ’€


πŸ”₯ See also πŸ”₯

  • do_allocate allocates memory [virtual] (virtual protected member function)

🏷️ Category 🏷️

  • Noindexed pages

source/version/date tea β˜•: http://cppreference.com, 2024.06.10, and the footer tag std::experi...ce::allocate(3) β€” signed, sealed, slayed. πŸ’–

πŸ“¦ where this page comes from