Random-access range
Warning: break range
Warning: break range
import std.algorithm : equal; auto q = Deque!int(); assert(equal(q[], new int[0])); q.insertBack(1); assert(equal(q[], [1])); q.insertBack(2); assert(equal(q[], [1, 2])); q.insertFront(3); assert(equal(q[], [3, 1, 2])); q.removeFront; assert(equal(q[], [1, 2])); q.insertBack(4); assert(equal(q[], [1, 2, 4])); q.insertFront(5); assert(equal(q[], [5, 1, 2, 4])); q.removeBack(); assert(equal(q[], [5, 1, 2]));
Deque on ring buffer