英語版
このページの英語版を見る
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-2025 by the D Language Foundation
DEEPL APIにより翻訳、ところどころ修正。
このページの最新版(英語)
このページの原文(英語)
翻訳時のdmdのバージョン: 2.108.0
サイト全体のドキュメントのdmdのバージョン: 2.109.1
最新のdmdのバージョン: 2.111.0 ダウンロード
翻訳日付:
HTML生成日時:
編集者: dokutoku