slice

package
v1.117.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MPL-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnSort added in v1.113.0

func ColumnSort[S ~[]E, E any](s S, columns int, cmp func(a, b E) int)

ColumnSort sorts the slice in place using the provided comparison function. The resulting order will be as if the slice was divided into columns and each column was sorted independently. If the slice is not evenly divisible by the number of columns, the extra elements will be distributed across the columns from left to right.

func ZeroedDelete deprecated

func ZeroedDelete[S ~[]E, E any](s S, i, j int) S

ZeroedDelete removes the elements s[i:j] from s, returning the modified slice. This function panics if s[i:j] is not a valid slice of s. This function modifies the contents of the slice s; it does not create a new slice. The elements that are removed are zeroed so that any references can be garbage collected. If you do not need this, use slices.Delete instead.

Deprecated: As of Go 1.22, slices.Delete now zeroes out removed elements, so use it instead. This function was deprecated on March 29, 2024 and will be removed on or after January 1, 2025.

func ZeroedDeleteFunc deprecated added in v1.90.0

func ZeroedDeleteFunc[S ~[]E, E any](s S, del func(E) bool) S

ZeroedDeleteFunc removes any elements from s for which del returns true, returning the modified slice. This function modifies the contents of the slice s; it does not create a new slice. The elements that are removed are zeroed so that any references can be garbage collected. If you do not need this, use slices.DeleteFunc instead.

Deprecated: As of Go 1.22, slices.DeleteFunc now zeroes out removed elements, so use it instead. This function was deprecated on March 29, 2024 and will be removed on or after January 1, 2025.

Types

This section is empty.

Jump to

Keyboard shortcuts

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