Back to Lo

It Toseqptr

docs/data/it-toseqptr.md

1.53.0298 B
Original Source

ToSeqPtr returns a sequence of pointers to each value.

go
collection := func(yield func(int) bool) {
    yield(1)
    yield(2)
    yield(3)
}

ptrs := it.ToSeqPtr(collection)
var result []*int
for ptr := range ptrs {
    result = append(result, ptr)
}
// result contains pointers to 1, 2, 3