Construct from source, which potentially needs GC-allocation (iff source.length > smallCapacity and source is not a string).
Construct from source of dchar
Get length.
Check if this is empty.
That this a hole, meaning a removed/erase value.
Check if this a hole, meaning a removed/erase value.
Check if this is a small ASCII string.
Check if this is equal to rhs.
Check if this is equal to rhs.
Return the indexed char of this.
Return a slice to either the whole large or whole small string.
Return a slice at [i .. j] to either the internally stored large or small string.
Check if this is null.
Get length.
Compare this with that.
Get hash of this, with extra fast computation for the small case.
Return this converted to a string, without any GC-allocation because this is immutable.
Return this converted to a string, which potentially needs GC-allocation (iff length > smallCapacity).
https://forum.dlang.org/post/pb87rn$2icb$1@digitalmars.com https://issues.dlang.org/show_bug.cgi?id=18792
https://forum.dlang.org/post/agzznbzkacfhyqvoezht@forum.dlang.org
TODO: Use extra bits in Short.length for these special text encodings: - 5-bit lowercase English letter into 128/5 = 25 chars - 5-bit uppercase English letter into 120/5 = 25 chars - 6-bit mixedcase English letter into 120/6 = 20 chars
TODO: Move to Phobos' std.typecons or std.array or std.string
Small-size-optimized (SSO) variant of string.
Storage is placed on the stack if the number of chars is less than smallCapacity, otherwise as a normal (large) string. The large string will be allocated on the GC-heap if the SSOString is constructed from a non-string (non-immutable char[]) parameter.
Because SSOString doesn't have a destructor it can safely allocate using a GC-backed region allocator without relying on a GC finalizer.
In order to mimic string/array/slice-behaviour, opCast returns false for SSOString() and true for SSOString(""). This requires SSOString() to default to a large string in which large pointer is set to null.
Big-endian platform support hasn't been verified.