"Strong" iterator pointer / link

Is there such a thing as a "strong" iterator. I mean an iterator that refers to the value that it refers to, and not to the address it is in, so if the value is replaced with another address, the iterator will continue to point to it in this new address; no matter where it moves to the data structure?

+4
source share
1 answer

Yes and no. But why? And what would you like to do std::iter_swap(strong_a, strong_b);?

As Karoly Horvath points out, you can implement your own container that has its own iterators (Iterator is just a concept, not just one type).

" , ", , . ( , , Allocators - ). - , .

, - -, - std::vector<strong_pointable<int>>, strong_pointable<int> int, " ", , , .

, . , , .

+1

All Articles