package nstd// MakeSlice makes a slice with the specified length.// Different from the built-in [make] function, the capacity// of the result slice might be larger than the length.func [ ~[], any]( int) {returnappend((nil), make(, )...)}// MakeSliceWithMinCap makes a slice with capacity not smaller than cap.// The length of the result slice is zero.//// See: https://github.com/golang/go/issues/69872func [ ~[], any]( int) {returnappend((nil), make(, )...)[:0]}// CloneSlice clones a slice.// Different from [slices.Clone], the result of CloneSlice// always has equal length and capacity.func [ ~[], any]( ) {var = make(, len())copy(, )return}// UnnamedSlice converts s to unnamed type.func [ ~[], any]( ) [] {return}// SliceElemPointers returns an iterator which iterates element pointers of a slice.func [ any]( []) func(func(*) bool) {returnfunc( func(*) bool) {for := range {if !(&[]) {break } } }}
The pages are generated with Goldsv0.7.9-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.