mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
19 lines
622 B
Text
19 lines
622 B
Text
Replace `std.experimental.allocator.IAllocator` with `std.experimental.allocator.RCIAllocator`
|
|
|
|
$(B Motivation):
|
|
|
|
Keep track of references to allocators so they don't escape, dangle,
|
|
and cause undefined behavior.
|
|
|
|
From now on, `RCIAllocator` will be used instead of the old `IAllocator`
|
|
interface. $(REF allocatorObject, std, experimental, allocator) can be used to build
|
|
a `RCIAllocator` out of a custom allocator.
|
|
|
|
------
|
|
import std.experimental.allocator.mallocator : Mallocator;
|
|
|
|
RCIAllocator a = allocatorObject(Mallocator.instance);
|
|
auto b = a.allocate(100);
|
|
assert(b.length == 100);
|
|
assert(a.deallocate(b));
|
|
------
|