>> >
>> > 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
>>
>

Incidentally I've been wondering how this works for slices of strings and 
haven't found much on golang.org or via google yet. Are allocations still 
avoided for arbitrary sized strings?

-- 
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/93FD0FB0-7667-4109-98B0-6926280F92BB%40gmail.com.

Reply via email to