Deque

Deque on ring buffer

Constructors

this
this(U[] values...)

Deque(1, 2, 3)

this
this(Range r)

Deque(iota(3))

Members

Aliases

Range
alias Range = RangeT!(DequePayload!T)

Random-access range

Functions

insertFront
void insertFront(T item)

Warning: break range

removeFront
void removeFront()

Warning: break range

Examples

1 import std.algorithm : equal;
2 auto q = Deque!int();
3 
4 assert(equal(q[], new int[0]));
5 q.insertBack(1);
6 assert(equal(q[], [1]));
7 q.insertBack(2);
8 assert(equal(q[], [1, 2]));
9 q.insertFront(3);
10 assert(equal(q[], [3, 1, 2]));
11 q.removeFront;
12 assert(equal(q[], [1, 2]));
13 q.insertBack(4);
14 assert(equal(q[], [1, 2, 4]));
15 q.insertFront(5);
16 assert(equal(q[], [5, 1, 2, 4]));
17 q.removeBack();
18 assert(equal(q[], [5, 1, 2]));

Meta