go4.orggo4.org/reflectutil Index | Files

package reflectutil

import "go4.org/reflectutil"

Package reflectutil contains reflect utilities.

Index

Functions

func Swapper

func Swapper(slice interface{}) func(i, j int)

Swapper returns a function which swaps the elements in slice. Swapper panics if the provided interface is not a slice.

Its goal is to work safely and efficiently for all versions and variants of Go: pre-Go1.5, Go1.5+, safe, unsafe, App Engine, GopherJS, etc.

Deprecated: this moved to the Go standard library. Use reflect.Swapper in Go 1.8+ instead.

Source Files

reflectutil.go swapper.go swapper_std.go

Version
v0.0.0-20230225012048-214862532bf5 (latest)
Published
Feb 25, 2023
Platform
linux/amd64
Imports
1 packages
Last checked
1 month ago

Tools for package owners.