Documentation
¶
Overview ¶
Package deque provides a type-safe, slice-backed, double-ended queue.
Index ¶
- type Deque
- func (d *Deque[T]) At(n int) (t T, ok bool)
- func (d *Deque[T]) Back() (t T, ok bool)
- func (d *Deque[T]) Cap() int
- func (d *Deque[T]) Clip()
- func (d *Deque[T]) Front() (v T, ok bool)
- func (d *Deque[T]) Grow(n int)
- func (d *Deque[T]) Len() int
- func (d *Deque[T]) PushBack(v T)
- func (d *Deque[T]) PushFront(v T)
- func (d *Deque[T]) RemoveBack() (t T, ok bool)
- func (d *Deque[T]) RemoveFront() (t T, ok bool)
- func (d *Deque[T]) String() string
- func (d *Deque[T]) Swap(i, j int)
- type Sortable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deque ¶
type Deque[T any] struct { // contains filtered or unexported fields }
Deque is a double-ended queue. It is not concurrency safe.
func (*Deque[T]) Grow ¶
Grow increases the deque's capacity, if necessary, to guarantee space for another n elements. After Grow(n), at least n elements can be appended to the deque without another allocation. If n is negative, Grow panics.
func (*Deque[T]) PushBack ¶
func (d *Deque[T]) PushBack(v T)
PushBack adds new value v to the end of the deque.
func (*Deque[T]) PushFront ¶
func (d *Deque[T]) PushFront(v T)
PushFront adds a new value v to the front of the deque.
func (*Deque[T]) RemoveBack ¶
RemoveBack removes and returns the back of the deque, if any.
func (*Deque[T]) RemoveFront ¶
RemoveFront removes and returns the front of the deque, if any.
Click to show internal directories.
Click to hide internal directories.