名前空間
変種
操作

std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate

提供: cppreference.com
 
 
動的メモリ管理
スマートポインタ
(C++11)
(C++11)
(C++11)
(C++17未満)
(C++11)
アロケータ
メモリリソース
未初期化記憶域
ガベージコレクションサポート
その他
(C++20)
(C++11)
(C++11)
C のライブラリ
低水準のメモリ管理
 
 
ヘッダ <scoped_allocator> で定義
(1)
pointer allocate( size_type n );
(C++11以上)
(C++20未満)
[[nodiscard]] pointer allocate( size_type n );
(C++20以上)
(2)
pointer allocate( size_type n, const_void_pointer hint );
(C++11以上)
(C++20未満)
[[nodiscard]] pointer allocate( size_type n, const_void_pointer hint );
(C++20以上)

未初期化記憶域を確保するために外側のアロケータを使用します。

1) std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n) を呼びます。
2) std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint) を呼ぶことによって、メモリの局所性のヒントを追加で提供します。

[編集] 引数

n - 何個のオブジェクトのための記憶域を確保するか
hint - 近くのメモリ位置を指すポインタ

[編集] 戻り値

確保した記憶域を指すポインタ。

[編集] 関連項目

未初期化記憶域を確保します
(std::allocator<T>のパブリックメンバ関数) [edit]
[静的]
アロケータを使用して未初期化記憶域を確保します
(std::allocator_traits<Alloc>のパブリック静的メンバ関数) [edit]