Updatable Iterators?


#1

I was trying to write a simple interval tree, but ran into a problem with the immutability of Iterators (link killed by forum software)

I’ve got a work around method now, but are there plans to add c++ style insert/remove methods and mutable Iterators? That seems like a useful thing to have for large collections


#2

My understanding is that the only collection in the standard library that can provide cursor/zipper like iterators efficiently is linked list, and its iterator has these methods already, though they are semi deprecated.

But it looks like that you are building a custom collection yourself, so it should be possible to add necessary methods (this dated post talks a bit about cursors at the end).


#3

Have a look at my red-black implementation in intrusive-collections, it has a cursor interface which allows you to move backwards & forwards through the sorted list of elements in the tree, and it allows you to insert elements at certain points in the tree.