more.sentinel

Contains types to differentiate arrays with sentinel values.

Members

Aliases

SentinelDstring
alias SentinelDstring = SentinelArray!(immutable(dchar))
Undocumented in source.
SentinelString
alias SentinelString = SentinelArray!(immutable(char))

An array of characters that contains a null-terminator at the length index.

SentinelWstring
alias SentinelWstring = SentinelArray!(immutable(wchar))
Undocumented in source.

Properties

StringLiteral
SentinelString StringLiteral [@property getter]
SentinelWstring StringLiteral [@property getter]
SentinelDstring StringLiteral [@property getter]

A template that coerces a string literal to a SentinelString. Note that this template becomes unnecessary if the type of string literal is changed to SentinelString.

assumeSentinel
auto assumeSentinel [@property getter]

Create a SentinelPtr from a normal pointer without checking that the array it is pointing to contains the sentinel value.

assumeSentinel
auto assumeSentinel [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
assumeSentinel
auto assumeSentinel [@property getter]

Coerce the given array to a SentinelArray without verifying that it contains the sentinel value at array.ptr[array.length].

assumeSentinel
auto assumeSentinel [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
reduceSentinel
auto reduceSentinel [@property getter]

This function converts an array to a SentinelArray. It requires that the last element array[$-1] be equal to the sentinel value. This differs from the function asSentinelArray which requires the first value outside of the bounds of the array array[$] to be equal to the sentinel value. This function does not require the array to "own" elements outside of its bounds.

verifySentinel
auto verifySentinel [@property getter]

Coerce the given array to a SentinelPtr. It checks and asserts if the given array does not contain the sentinel value at array.ptr[array.length].

Templates

SentinelArray
template SentinelArray(T, T sentinelValue = defaultSentinel!T)

An array with the extra requirement that it ends with a sentinel value at ptr[length].

SentinelPtr
template SentinelPtr(T, T sentinelValue = defaultSentinel!T)

A pointer to an array with a sentinel value.

Meta