Function ScratchBuffer.tryReserve

Ensures at least the requested backing capacity without relocating live elements.

bool tryReserve(
  size_t minCapacity
) nothrow @nogc @safe;

Parameters

NameDescription
minCapacity minimum number of backing slots required

Returns

true when the current capacity already satisfies the request or when an empty buffer was successfully grown; false when growth would be required while live elements exist.

Failure

A false result leaves capacity, live elements, and their addresses unchanged. Allocation failure follows the runtime-storage fatal OOM contract.

Allocation

Growth while empty replaces the backing allocation with exactly minCapacity slots. No geometric growth policy is embedded.