vector

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VectorBlockSize = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator[T any] struct {
	// contains filtered or unexported fields
}

Iterator holding the iterator's state

func (*Iterator[T]) Begin

func (v *Iterator[T]) Begin()

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

func (*Iterator[T]) End

func (v *Iterator[T]) End()

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

func (*Iterator[T]) First

func (v *Iterator[T]) 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[T]) Index

func (v *Iterator[T]) Index() int

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

func (*Iterator[T]) Last

func (v *Iterator[T]) 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[T]) Next

func (v *Iterator[T]) 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[T]) Prev

func (v *Iterator[T]) 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[T]) Value

func (v *Iterator[T]) Value() T

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

type Vector

type Vector[T any] struct {
	// contains filtered or unexported fields
}

func (*Vector[T]) Back

func (v *Vector[T]) Back() T

func (*Vector[T]) Clear

func (v *Vector[T]) Clear()

func (*Vector[T]) Empty

func (v *Vector[T]) Empty() bool

func (*Vector[T]) Erase

func (v *Vector[T]) Erase(index int)

func (*Vector[T]) Front

func (v *Vector[T]) Front() T

func (*Vector[T]) Get

func (v *Vector[T]) Get(index int) T

func (*Vector[T]) Iterator

func (v *Vector[T]) Iterator() Iterator[T]

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

func (*Vector[T]) Len

func (v *Vector[T]) Len() int

func (*Vector[T]) Less

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

func (*Vector[T]) PopBack

func (v *Vector[T]) PopBack()

func (*Vector[T]) PopFront

func (v *Vector[T]) PopFront()

func (*Vector[T]) PushBack

func (v *Vector[T]) PushBack(value T)

func (*Vector[T]) PushFront

func (v *Vector[T]) PushFront(value T)

func (*Vector[T]) Size

func (v *Vector[T]) Size() int

func (*Vector[T]) Swap

func (v *Vector[T]) Swap(i, j int)

func (*Vector[T]) Values

func (v *Vector[T]) Values() []T

Jump to

Keyboard shortcuts

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