dkh.container.deque

  • Declaration

    struct Deque(T, bool mayNull = true);

    Deque on ring buffer

    Examples

    1. 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]));

    • Declaration

      this(U)(U[] values...) if (isImplicitlyConvertible!(U, T));

      Deque(1, 2, 3)

    • Declaration

      this(Range)(Range r) if (isInputRange!Range && isImplicitlyConvertible!(ElementType!Range, T) && !is(Range == T[]));

      Deque(iota(3))

    • Declaration

      const @property bool empty();

    • Declaration

      const @property size_t length();
      alias opDollar = length;

    • Declaration

      inout ref inout(T) opIndex(size_t i);

    • Declaration

      inout ref inout(T) front();

    • Declaration

      inout ref inout(T) back();

    • Declaration

      void clear();

    • Declaration

      void insertFront(T item);

      Warning: break range

    • Declaration

      void insertBack(T item);
      template opOpAssign(string op : "~")
      alias stableInsertBack = insertBack;

    • Declaration

      void removeFront();

      Warning: break range

    • Declaration

      void removeBack();
      alias stableRemoveBack = removeBack;

    • Declaration

      alias Range = RangeT!(DequePayload!T);
      alias ConstRange = RangeT!(const(DequePayload!T));
      alias ImmutableRange = RangeT!(immutable(DequePayload!T));

      Random-access range

    • Declaration

      const size_t[2] opSlice(size_t dim : 0)(size_t start, size_t end);

    • Declaration

      Range opIndex(size_t[2] rng);
      const ConstRange opIndex(size_t[2] rng);
      immutable ImmutableRange opIndex(size_t[2] rng);
      inout auto opIndex();

      Get slice