std::allocation_result(3)

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

πŸ’– NAME πŸ’–

std::allocation_result - std::allocation_result. okay so bestie, welcome to the C++ Standard Libary manual β€” this page is literally the name twice, and that's iconic.


✨ Synopsis ✨

Defined in header <memory>

template< class Pointer, class SizeType = std::size_t >  (since
C++23)
struct allocation_result;

allocation_result specializations are returned from the allocate_at_least member function of appropriate Allocator types (e.g. std::allocator::allocate_at_least) and std::allocator_traits::allocate_at_least.

Every specialization of allocation_result has no base classes or declared members other than ptr and count, thus it is suitable for aggregate initialization and structured binding.

πŸŽ€ Template parameters πŸŽ€

  • Pointer β€” typically std::allocator_traits<Alloc>::pointer, where Alloc is an Allocator type.
  • SizeType β€” typically std::allocator_traits<Alloc>::size_type, where Alloc is an Allocator type.

πŸ¦‹ Data members πŸ¦‹

Member name β†’ Definition:

  • ptr β€” a pointer of type Pointer which is typically used for the address of the first element in the storage allocated by allocate_at_least (public member object).
  • count β€” a value of type SizeType which is typically used for the actual number of elements in the storage allocated by allocate_at_least (public member object).

🌸 Notes 🌸

Pointer and SizeType are a pointer to an object type and std::make_unsigned_t<std::ptrdiff_t> (which is almost always same as std::size_t) by default.

πŸ”₯ Feature-test macro πŸ”₯

  • __cpp_lib_allocate_at_least β€” value 202302L, std (C++23), feature: Size-feedback in the Allocator interface.

😭 Example 😭

This section is incomplete Reason: no example

πŸ‘‘ See also πŸ‘‘

  • allocate_at_least β€” allocates uninitialized storage at least as large as requested. (C++23) size (public member function of std::allocator<T>).
  • allocate_at_least β€” allocates storage at least as large as the requested size via an allocate_at_least allocator. [static] (C++23) (public static member function of std::allocator_traits<Alloc>).

πŸ’€ Category πŸ’€

  • * Todo no example

πŸ’– that's the whole page, bestie β€” source/version/date: http://cppreference.com Β· 2024.06.10 Β· page: std::allocation_result(3) πŸ’–

πŸ“¦ where this page comes from