LimitArray.CommonMixin

Undocumented in source.
template LimitArray(T)
static if(!(!is(T == Unqual!T)))
enum CommonMixin = q{ pragma(inline) @property auto asArray() { return this.ptr[0 .. limit - ptr]; } pragma(inline) auto slice(size_t offset) { auto newPtr = ptr + offset; assert(newPtr <= limit, "slice offset range violation"); return typeof(this)(newPtr, limit); } pragma(inline) auto slice(size_t offset, size_t newLimit) in { assert(newLimit >= offset, "slice offset range violation"); } do { auto newLimitPtr = ptr + newLimit; assert(newLimitPtr <= limit, "slice limit range violation"); return typeof(this)(ptr + offset, ptr + newLimit); } pragma(inline) auto ptrSlice(typeof(this.ptr) ptr) { auto copy = this; copy.ptr = ptr; return copy; } };

Meta