Legal answer: no. This is just your interpretation. This is technically correct, but it may not be the only technically correct interpretation.
Technical answer: here it should be avoided that the exception created by the mutating iterator (think of an insertor or output iterator) forces the algorithm to fail, allowing the container to be undefined and inconsistent (think, for example, of a linked list with links that are not yet fully related )
This is not just a bad_alloc question for iterators who have a dynamically distributed state, but also an iterator who, being its own copy, tries to change the related element in this case (for example, because the item clause is selected).
When this happens, the iterator does not need to โcomplete the algorithmโ (this would be impossible), but leave the container in a constant and still manageable state.
source share