Golang Slice Tricks
Published: August 4, 2021
Tags:
Filtering with allocating
This trick uses the fact that a slice shares the same backing array and capacity as the original, so the storage is reused for the filtered slice. Of course, the original contents are modified.
|
|
It will help me to improve/learn.