ScopeBuffer.this

Initialize with buf to use as scratch buffer space.

struct ScopeBuffer(T, alias realloc = .realloc)
this
(
T[] buf
)
in { assert (!(buf.length & wasResized)); assert (buf.length <= uint.max); }
if (
isAssignable!T &&
!hasElaborateDestructor!T
&&
!hasElaborateCopyConstructor!T
&&
!hasElaborateAssign!T
)

Parameters

buf
Type: T[]

Scratch buffer space, must have length that is even

Examples

ubyte[10] tmpbuf = void;
auto sbuf = ScopeBuffer!ubyte(tmpbuf);

If buf was created by the same realloc passed as a parameter to ScopeBuffer, then the contents of ScopeBuffer can be extracted without needing to copy them, and ScopeBuffer.free() will not need to be called.

Meta