Remember all iterators become invalid for vectors if an object is added or removed it.
You say “concurrent modification”, so is your program threaded?
As an aside, STL maps are not efficient if you are constantly creating/updating them (if it’s static data or few updates then fine). They use a Red Black tree underneath which gets rebalanced at every change.
You would probably be better with a STL list and just traverse it until the objects Z is larger than the current position. Or, throw them all in and use sort.
Of course, with all performance changes, never assume anything. Measure then change.
–Stuart.