New returns a new addressable slice value of type ty.
(ty reflect.Type, len, cap int)
| 23 | |
| 24 | // New returns a new addressable slice value of type ty. |
| 25 | func New(ty reflect.Type, len, cap int) reflect.Value { |
| 26 | ptr := reflect.New(ty) |
| 27 | ptr.Elem().Set(reflect.MakeSlice(ty, len, cap)) |
| 28 | return ptr.Elem() |
| 29 | } |
| 30 | |
| 31 | // Replace replaces count elements of s starting from first with with. |
| 32 | // s must be a pointer to a slice. |