§23.1.2.8 in the standard states that insertion/deletion operations on a set/map will not invalidate any iterators to those objects (except iterators pointing to a deleted eleme
Well, there's nothing preventing particular collection implementation from having end()
depend on the instance of collection and time of day, as long as comparisons and such work. Which means, that, perhaps, end()
value may change, but old_end == end()
comparison should still yield true. (edit: although after reading the comment from j_random_hacker, I doubt this paragraph itself evaluates to true ;-), not universally — see the discussion below )
I also doubt you can use std::map
in the Node
class due to the type being incomplete, yet (not sure, though).
Also, since your nodes are uniquely numbered, you can use int
for keying them and reserve some value for invalid.