ringbuffer

package
v1.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2022 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueArray

type QueArray struct {
	// contains filtered or unexported fields
}

func (*QueArray) Pop

func (s *QueArray) Pop() interface{}

func (*QueArray) Push

func (s *QueArray) Push(elem interface{})

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

先进先出

func NewQueue

func NewQueue() *Queue

容量是2的n次幂,非线程安全,适当的初始容量大小可以减少内存分配次数 对比QueArray有一倍左右的性能提升

func (*Queue) Back

func (q *Queue) Back() interface{}

返回队头

func (*Queue) Front

func (q *Queue) Front() interface{}

返回队头

func (*Queue) Get

func (q *Queue) Get(i int) interface{}

正数队头遍历,负数队尾遍历

func (*Queue) Length

func (q *Queue) Length() int

func (*Queue) PopFront

func (q *Queue) PopFront() interface{}

弹出队头

func (*Queue) PushBack

func (q *Queue) PushBack(elem interface{})

追加到队尾

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL