vector

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VectorBlockSize = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IVector

type IVector interface {
	containers.Container

	Erase(int)
	PushFront(interface{})
	PushBack(interface{})
	PopFront()
	PopBack()
	Front() interface{}
	Back() interface{}
	Len() int
	Get(int) interface{}
	Swap(i, j int)
	Less(i, j int) bool
	// contains filtered or unexported methods
}

type Iterator

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

Iterator holding the iterator's state

func (*Iterator) Begin

func (v *Iterator) Begin()

Begin resets the iterator to its initial state (one-before-first) Call Next() to fetch the first element if any.

func (*Iterator) End

func (v *Iterator) End()

End moves the iterator past the last element (one-past-the-end). Call Prev() to fetch the last element if any.

func (*Iterator) First

func (v *Iterator) First() bool

First moves the iterator to the first element and returns true if there was a first element in the container. If First() returns true, then first element's index and value can be retrieved by Index() and Value(). Modifies the state of the iterator.

func (*Iterator) Index

func (v *Iterator) Index() int

Index returns the current element's index. Does not modify the state of the iterator.

func (*Iterator) Last

func (v *Iterator) Last() bool

Last moves the iterator to the last element and returns true if there was a last element in the container. If Last() returns true, then last element's index and value can be retrieved by Index() and Value(). Modifies the state of the iterator.

func (*Iterator) Next

func (v *Iterator) Next() bool

Next moves the iterator to the next element and returns true if there was a next element in the container. If Next() returns true, then next element's index and value can be retrieved by Index() and Value(). If Next() was called for the first time, then it will point the iterator to the first element if it exists. Modifies the state of the iterator.

func (*Iterator) Prev

func (v *Iterator) Prev() bool

Prev moves the iterator to the previous element and returns true if there was a previous element in the container. If Prev() returns true, then previous element's index and value can be retrieved by Index() and Value(). Modifies the state of the iterator.

func (*Iterator) Value

func (v *Iterator) Value() interface{}

Value returns the current element's value. Does not modify the state of the iterator.

type Vector

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

func NewVector

func NewVector() *Vector

func (*Vector) Back

func (v *Vector) Back() interface{}

func (*Vector) Clear

func (v *Vector) Clear()

func (*Vector) Empty

func (v *Vector) Empty() bool

func (*Vector) Erase

func (v *Vector) Erase(index int)

func (*Vector) Front

func (v *Vector) Front() interface{}

func (*Vector) Get

func (v *Vector) Get(index int) interface{}

func (*Vector) Iterator

func (v *Vector) Iterator() Iterator

Iterator returns a stateful iterator whose values can be fetched by an index.

func (*Vector) Len

func (v *Vector) Len() int

func (*Vector) Less

func (v *Vector) Less(i, j int) bool

func (*Vector) PopBack

func (v *Vector) PopBack()

func (*Vector) PopFront

func (v *Vector) PopFront()

func (*Vector) PushBack

func (v *Vector) PushBack(value interface{})

func (*Vector) PushFront

func (v *Vector) PushFront(value interface{})

func (*Vector) Size

func (v *Vector) Size() int

func (*Vector) Swap

func (v *Vector) Swap(i, j int)

func (*Vector) Values

func (v *Vector) Values() []interface{}

Jump to

Keyboard shortcuts

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