Documentation ¶
Overview ¶
Package ringdeque provides the Deque type.
Index ¶
- type Deque
- func (d *Deque[T]) Clear()
- func (d *Deque[T]) Empty() bool
- func (d *Deque[T]) Len() int
- func (d *Deque[T]) PeekBack() T
- func (d *Deque[T]) PeekBackPtr() *T
- func (d *Deque[T]) PeekFront() T
- func (d *Deque[T]) PeekFrontPtr() *T
- func (d *Deque[T]) PopBack() (x T)
- func (d *Deque[T]) PopFront() (x T)
- func (d *Deque[T]) PushBack(x T)
- func (d *Deque[T]) PushFront(x T)
- func (d *Deque[T]) RemoveBack()
- func (d *Deque[T]) RemoveFront()
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 }
A Deque implements a double-ended queue of values of type T using a resizable ring buffer.
Deque is not safe to use concurrently from multiple goroutines.
func (*Deque[T]) PeekBack ¶
func (d *Deque[T]) PeekBack() T
PeekBack returns the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekBackPtr ¶
func (d *Deque[T]) PeekBackPtr() *T
PeekBackPtr returns a pointer to the value at the back of d. The pointer is only valid until the next mutation of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekFront ¶
func (d *Deque[T]) PeekFront() T
PeekFront returns the value at the front of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekFrontPtr ¶
func (d *Deque[T]) PeekFrontPtr() *T
PeekFrontPtr returns a pointer to the value at the front of d. The pointer is only valid until the next mutation of d.
Preconditions: !d.Empty().
func (*Deque[T]) PopBack ¶
func (d *Deque[T]) PopBack() (x T)
PopBack removes and returns the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) PopFront ¶
func (d *Deque[T]) PopFront() (x T)
PopFront removes and returns the value at the front of d.
Preconditions: !d.Empty().
func (*Deque[T]) PushFront ¶
func (d *Deque[T]) PushFront(x T)
PushFront inserts x at the front of d.
func (*Deque[T]) RemoveBack ¶
func (d *Deque[T]) RemoveBack()
RemoveBack removes the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) RemoveFront ¶
func (d *Deque[T]) RemoveFront()
RemoveFront removes the value at the front of d.
Preconditions: !d.Empty().