DequeType

A Deque is a data structure comprised of two queues. This implementation has a front queue, which is reversed, and a back queue, which is not. Operations at either end of the Deque have the same complexity as operations on the end of either queue.

Three structs conform to the DequeType protocol: Deque, DequeSlice, and ContiguousDeque. These correspond to the standard library array types.

  • A textual representation of self, suitable for debugging.

    Declaration

    Swift

    public var debugDescription: String
  • Construct from a collection

    Declaration

    Swift

    public init<
        C : CollectionType where
        C.Index : RandomAccessIndexType,
        C.SubSequence.Generator.Element == Container.Generator.Element,
        C.Index.Distance == Container.Index.Distance
        >(col: C)
  • Reserve enough space to store minimumCapacity elements.

    • Postcondition: capacity >= minimumCapacity and the Deque has mutable contiguous storage.
    • Complexity: O(count).

    Declaration

    Swift

    public mutating func reserveCapacity(n: Container.Index.Distance)
  • Return a Deque containing the elements of self in reverse order.

    Declaration

    Swift

    public func reverse() -> Self
  • Return a value less than or equal to the number of elements in self, nondestructively.

    Declaration

    Swift

    public func underestimateCount() -> Int