英語版
このページの英語版を見る
std.experimental.allocator.building_blocks.scoped_allocator
- struct
ScopedAllocator
(ParentAllocator); ScopedAllocator
はすべての割り当て要求をParentAllocator に委任する。 破棄されるとScopedAllocator
オブジェクトが破棄されると、自動的にdeallocate を呼び出す。(deallocateAll 関数も同じセマンティクスで実装されている)。deallocate もサポートされている。 のオーバーヘッドが発生する。ScopedAllocator
もサポートされている。deallocate 。 AllocatorList とRegion を組み合わせたよりシンプルな設計を推奨する。Examples:import std.experimental.allocator.mallocator : Mallocator; import std.typecons : Ternary; ScopedAllocator!Mallocator alloc; writeln(alloc.empty); // Ternary.yes const b = alloc.allocate(10); writeln(b.length); // 10 writeln(alloc.empty); // Ternary.no
- Allocator
parent
; - ParentAllocator がステートフルな場合、
parent
へのアクセスを与えるプロパティである。 AffixAllocator!ParentAllocator へのアクセスを与えるプロパティである、parent
はAffixAllocator!ParentAllocator.instance のエイリアスである。 - enum auto
alignment
; - アライメント
- size_t
goodAllocSize
(size_tn
); - に転送する。 parent.
goodAllocSize
(これは に転送する(これは管理オーバーヘッドを考慮する)。 - void[]
allocate
(size_tn
); - メモリを確保する。管理のために、実際には親から余分なメモリを確保する。 を確保する。
- bool
expand
(ref void[]b
, size_tdelta
); - parent.expand(b, delta) に転送する。
- bool
reallocate
(ref void[]b
, size_ts
); - 新しいサイズに再割り当てする。
b
を新しいサイズに再割り当てする。s
. - Ternary
owns
(void[]b
); - に転送する。 parent.
owns
(b
). - bool
deallocate
(void[]b
); - デアロケートする
b
. - bool
deallocateAll
(); - 割り当てられたすべてのメモリを解放する。
- const pure nothrow @nogc @safe Ternary
empty
(); - このアロケータがどのメモリにも責任を負わない場合はTernary.yes を返す、 Ternary.no を返す。(決してTernary.unknown を返さない)。
Copyright © 1999-2024 by the D Language Foundation
DEEPL APIにより翻訳、ところどころ修正。
このページの最新版(英語)
このページの原文(英語)
翻訳時のdmdのバージョン: 2.108.0
ドキュメントのdmdのバージョン: 2.109.1
翻訳日付 :
HTML生成日時:
編集者: dokutoku