Stack

Stack

Constructors

this
this(U[] values)

Stack(1, 2, 3)

this
this(Range r)

Stack(iota(3))

Members

Aliases

ConstRange
alias ConstRange = RangeT!(const StackPayload!T)
Undocumented in source.
ImmutableRange
alias ImmutableRange = RangeT!(immutable StackPayload!T)
Undocumented in source.
Payload
alias Payload = StackPayload!T
Undocumented in source.
Range
alias Range = RangeT!(StackPayload!T)

Random-access range

opDollar
alias opDollar = length
Undocumented in source.
opOpAssign
alias opOpAssign(string op : "~") = insertBack
Undocumented in source.
stableInsertBack
alias stableInsertBack = insertBack
Undocumented in source.
stableRemoveBack
alias stableRemoveBack = removeBack
Undocumented in source.

Functions

back
inout(T) back()
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
front
inout(T) front()
Undocumented in source. Be warned that the author may not have intended to support it.
insertBack
void insertBack(T item)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
inout(T) opIndex(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
Range opIndex(size_t[2] rng)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
ConstRange opIndex(size_t[2] rng)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
ImmutableRange opIndex(size_t[2] rng)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
auto opIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
opSlice
size_t[2] opSlice(size_t start, size_t end)
Undocumented in source. Be warned that the author may not have intended to support it.
removeBack
void removeBack()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

data
inout(T)[] data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
empty
bool empty [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

RangeT
struct RangeT(QualifiedPayload)
Undocumented in source.

Examples

import std.algorithm : equal;
import std.range.primitives : isRandomAccessRange;
import std.container.util : make;
auto q = Stack!int();

assert(equal(q[], new int[0]));
q.insertBack(1);
assert(equal(q[], [1]));
q.insertBack(2);
assert(equal(q[], [1, 2]));
q.insertBack(3);
assert(equal(q[], [1, 2, 3]));
q.removeBack();
assert(equal(q[], [1, 2]));
q.insertBack(4);
assert(equal(q[], [1, 2, 4]));
q.removeBack();
assert(equal(q[], [1, 2]));

Meta