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)  {
	return append((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/69872
func [ ~[],  any]( int)  {
	return append((nil), make(, )...)[:0]
}

// BlankMap returns a blank map which has the same type as the input map.
// * Usage 1: `ZeroMap[MapType](nil, 32)
// * Usage 2: `ZeroMap(aMap, 8)
func [ ~map[],  comparable,  any]( ,  int)  {
	return make(, )
}

// CollectMapKeys collects all the keys in a map into a freshly
// created result slice. The length and capacity of the result slice
// are both equal to the length of the map.
//
// See: https://github.com/golang/go/issues/68261
func [ comparable,  any]( map[]) [] {
	if len() == 0 {
		return nil
	}

	var  = make([], 0, len())
	for  := range  {
		 = append(, )
	}
	return 
}

// AppendMapKeys appends all the keys in a map into the specified slice.
func [ comparable,  any]( [],  map[]) [] {
	for  := range  {
		 = append(, )
	}
	return 
}