在线文档教程
C++
动态内存管理 | Dynamic memory management

std::pmr::polymorphic_allocator::allocate

STD::PMR::多态[医]分配器::分配

T* allocate( std::size_t n (since C++17)

为n类型对象T使用底层内存资源。相当于return static_cast<T*>(this->resource()->allocate(n * sizeof(T), alignof(T))

参数

n-the number of objects to allocate storage for

返回值

指向分配的存储的指针。

另见

allocate staticallocates uninitialized storage using the allocator (public static member function of std::allocator_traits)
allocateallocates memory (public member function of std::pmr::memory_resource)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cpPreference.com/w/cpp/Memory/多态[医]分配器/分配