◐ Shell
clean mode source ↗

std::pmr::memory_resource::allocate - cppreference.com

提供: cppreference.com

<tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody>

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

(C++17以上)
(C++20未満)

[[nodiscard]] void* allocate(std::size_t bytes, std::size_t alignment = alignof(std::max_align_t));

(C++20以上)

少なくとも bytes バイトのサイズを持つ記憶域を確保します。 返された記憶域は、そのようなアライメントがサポートされていれば指定された alignment に、そうでなければ alignof(std::max_align_t) にアラインされます。

return do_allocate(bytes, alignment); と同等です。

例外

要求されたサイズおよびアライメントの記憶域が取得できない場合は例外を投げます。

関連項目