Closed BoraBak closed 2 years ago
Hello! @BoraBak -
The reason why it’s not trivial to loop over the Set is because the internal map-based implementation is not readily exposed by design.
This protects the end-user from potentially peeking/corrupting internal state and is generally a good practice however there is an Iter helper method that does expose a callback based iterator to do exactly this.
See the unit-tests for how to utilize the Iter technique to accomplish your needs without having to rely on ToSlice.
In order to loop (for loop) over a Set, I need to prior use the
ToSlice()
method. I was wondering why is that? Why not simply allow to loop over the Set instance?