Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly 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 using
a local clone.
dmd.common.smallbuffer
Common string functions including filename manipulation.
Authors:
Walter Bright, https://www.digitalmars.com
License:
Source common/smallbuffer.d
Documentation https://dlang.org/phobos/dmd_common_smallbuffer.html
- struct
SmallBuffer
(Element); - Defines a temporary array of Elements using a fixed-length buffer as back store. If the length of the buffer suffices, it is readily used. Otherwise, malloc is used to allocate memory for the array and free is used for deallocation in the destructor.This type is meant to use exclusively as an automatic variable. It is not default 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[]);
- scope this(size_t
len
, return scope Element[]buffer
); - Construct a SmallBufferParameters:
size_t len
number of elements in array Element[] buffer
slice to use as backing-store, if len will fit in it - scope void
create
(size_tlen
); - Resize existing SmallBuffer.Parameters:
size_t len
number of elements after resize
Copyright © 1999-2024 by the D Language Foundation | Page generated by
Ddoc on (no date time)