|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
(C++20/26*) | ||||
polymorphic_allocator::allocate_object (C++20) | ||||
| Non-member functions | ||||
(until C++20) |
template<class U> U* allocate_object(std::size_t n=1); | (since C++20) | |
Allocates storage forn objects of typeU using the underlying memory resource.
Ifstd::numeric_limits<std::size_t>::max()/ sizeof(U)< n, throwsstd::bad_array_new_length, otherwise equivalent toreturnstatic_cast<U*>(allocate_bytes(n* sizeof(U), alignof(U)));.
Contents |
| n | - | the number of objects to allocate storage for |
A pointer to the allocated storage.
This function was introduced for use with the fully-specialized allocatorstd::pmr::polymorphic_allocator<>, but it may be useful in any specialization as a shortcut to avoid having to rebind fromstd::pmr::polymorphic_allocator<T> tostd::pmr::polymorphic_allocator<U>.
SinceU is not deduced, it must be provided as a template argument when calling this function.
Throwsstd::bad_array_new_length ifn>std::numeric_limits<std::size_t>::max()/ sizeof(U); may also be any exceptions thrown by the call toresource()->allocate.
(C++20) | allocate raw aligned memory from the underlying resource (public member function)[edit] |
(C++20) | allocates and constructs an object (public member function)[edit] |
| allocate memory (public member function)[edit] | |
[static] | allocates uninitialized storage using the allocator (public static member function of std::allocator_traits<Alloc>)[edit] |
| allocates memory (public member function of std::pmr::memory_resource)[edit] |