constructor size is the size in bytes, default is 64 KiB
empty stack, sets all bytes to zero, resets seek
pops from stack
pops multiple from stack. first popped is last in array
pushes to stack
pushes multiple elements to stack. last in array is first pushed
if an error has occured, since this was last called
seek index (number of bytes used on stack)
NaStack s = new NaStack(); s.push!integer(integer.max); s.push!ubyte(255); s.push!byte(127); byte b; b = 0; ubyte ub; ub = 0; integer[] iA = [0]; assert(s.errored == false); s.pop(b); s.pop(ub); s.pop(iA[0]); assert(b == 127); assert(ub == 255); assert(iA[0] == integer.max); iA = [integer.max, integer.max >> 1, 0, 1025]; s.pushArray(iA); iA[] = 0; s.popArray(iA); assert(iA == [integer.max, integer.max >> 1, 0, 1025]); s.push(cast(integer)integer.max); s.push(cast(integer)integer.max >> 1); s.push(cast(integer)0); s.push(cast(integer)1025); iA[] = 0; s.popArray(iA); assert(iA == [integer.max, integer.max >> 1, 0, 1025]); assert(s.errored == false); .destroy(s);
Stack, with no fixed data type for elements.
Right now its not used anywhere, but it migth be useful.