Documentation ¶
Index ¶
- func Copy[T any](dst *Vector[T], src Vector[T]) int
- func CopyAt[T any](dst *Vector[T], src Vector[T], at int) int
- func Fold[T any](vec Vector[T], init T, f func(acc T, elem T) T) T
- func Sort[T constraints.Ordered](vec *Vector[T])
- type Vector
- func Chunks[T any](vec Vector[T], size int) (Vector[*Vector[T]], error)
- func Concat[T any](head Vector[T], tails ...Vector[T]) Vector[T]
- func Cycle[T any](vec Vector[T], num int) Vector[T]
- func FromSlice[T any](xs []T) Vector[T]
- func FromValues[T any](xs ...T) Vector[T]
- func Map[T any, R any](vec Vector[T], f func(T) R) Vector[R]
- func MapFilter[T any, R any](vec Vector[T], f func(T) option.Option[R]) Vector[R]
- func Repeat[T any](init T, num int) Vector[T]
- func Window[T any](vec Vector[T], size int) (Vector[*Vector[T]], error)
- func WithCapacity[T any](cap int) Vector[T]
- func (vec *Vector[T]) Capacity() int
- func (vec *Vector[T]) Empty() bool
- func (vec *Vector[T]) Extend(other Vector[T])
- func (vec *Vector[T]) ExtendBy(elem T, num int)
- func (vec *Vector[T]) ForEach(f func(T))
- func (vec *Vector[T]) Get(i int) T
- func (vec *Vector[T]) Partition(f func(elem T) bool) int
- func (vec *Vector[T]) Push(x T)
- func (vec *Vector[T]) Reserve(additional int)
- func (vec *Vector[T]) ShrinkToFit()
- func (vec *Vector[T]) Size() int
- func (vec *Vector[T]) Swap(i int, j int)
- func (vec Vector[T]) ToSlice() []T
- func (vec *Vector[T]) TryPop() option.Option[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sort ¶ added in v0.0.4
func Sort[T constraints.Ordered](vec *Vector[T])
Types ¶
type Vector ¶
type Vector[T any] struct { // contains filtered or unexported fields }
func FromValues ¶
func WithCapacity ¶
func (*Vector[T]) Partition ¶ added in v0.0.4
Partition changes the positions of the elements in the given vector: those that pass f are moved to the head positions; those that fail to the tail positions. Partition is NOT stable - it doesn't maintain the element order in each partition. Returns the partition cursor: the index of the first element of the second partition, (it contains all the elements failing f)
func (*Vector[T]) ShrinkToFit ¶
func (vec *Vector[T]) ShrinkToFit()
Click to show internal directories.
Click to hide internal directories.