On 06.02.21 03:32, Wojciech S. Czarnecki wrote:
Dnia 2021-02-04, o godz. 00:30:57
Selahaddin Harmankaya <selahaddinh...@gmail.com> napisaƂ(a):

There are obviously more things to consider

Slice is not an array, it is a _view_into_ an array. Many such views
into the same array may exist simultaneously.

A "remove element from _slice_" operation always must make a new array
and copy all elements that you intend to stay. Current idiom using append
will do this for you while being frank about costs.

Maybe I misunderstand what you wrote, but as long as the slice has enough capacity the array will be reused and not not copied:

https://play.golang.org/p/sevpWixzw6V


See: https://blog.golang.org/slices-intro
and: 
https://www.digitalocean.com/community/tutorials/understanding-arrays-and-slices-in-go


Hope this helps,


--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0d4cd277-7860-9bdb-103a-9af75712a06e%40mb0.org.

Reply via email to