Report a bugIf you spot a problem with this page, click here to create a Bugzilla issue.
Improve this pageQuickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.
dmd.common.smallbuffer
Common string functions including filename manipulation.
struct
SmallBuffer(Element);
Defines a temporary array ofElements using a fixed-length buffer as back store. If the lengthof the buffer suffices, it is readily used. Otherwise,malloc is used toallocate memory for the array andfree is used for deallocation in thedestructor.
This type is meant to use exclusively as an automatic variable. It is notdefault constructible or copyable.
Examples:ditto
char[230] buf =void;auto a =SmallBuffer!char(10, buf);assert(a[]is buf[0 .. 10]);auto b =SmallBuffer!char(1000, buf);assert(b[] !is buf[]);b.create(1000);assert(b.length == 1000);assert(b[] !is buf[]);
this(size_t
len, return scope Element[]
buffer) scope;
Construct a SmallBuffer
Parameters:size_tlen | number of elements in array |
Element[]buffer | slice to use as backing-store, if len will fit in it |
void
create(size_t
len) scope;
Resize existing SmallBuffer.
Parameters:size_tlen | number of elements after resize |