c++ - A "strong" iterator pointer/reference -


is there such thing "strong" iterator. mean iterator sticks value referencing rather address in, such if value gets swapped different address, iterator continue pointing in new address; regardless of gets moved in data structure?

yes , no. why? , want std::iter_swap(strong_a, strong_b); do?

as karoly horvath points out, implement own container has own iterators (iterator concept, not 1 type).

as way "implement 1 work standard library nicely", depends part of standard library have in mind. can't go adding things containers (unless can figure out way implement want allocators or something). if created own somehow, you'd have level of compatibility standard algorithms.

finally, implement special wrapper class, let std::vector<strong_pointable<int>> strong_pointable<int> act int let provide way special "strong pointer" or whatever want call keep track of things move-constructed.

but odd thing ask for. suspect doing wrong if want functionality.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -