-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
Slice
is a powerful and commonly used data structure in Go to organize multiple items in a sequence, but there are cases where List
is a better choice. One such case could be where the number of items is large and arbitrary items are inserted one by one while maintaining certain sort order. Insertion or deletion at arbitrary places in a Slice would cause relocation of the trailing items.
For this reason if one chooses to use List
over Slice
, it comes with a cost of not being able to use Range
iterator syntax. Consequently, the List
is not supported by the template iterator system ({{range pipeline}}
) either.
Hence, I am proposing the addition of Range
iterator support for List
data structure.