-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
It seems that Golang has made a "range-over-function" feature after Go 1.23, which is included in the standard library iter (doc). I wonder if there are plans to implement these newly added interface in the later versions?
For example, we can add a .iter() method to each container types. I believe this would not break the existing logic:
package main
import (
"fmt"
"github.com/liyue201/gostl/ds/list/simplelist"
)
func main() {
l := simplelist.New[int]()
l.PushBack(1)
l.PushFront(2)
l.PushFront(3)
l.PushBack(4)
for ele := range l.iter() {
// Do something
}
fmt.Printf("\n===============\n")
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels