There's no definitive answer to this question. The answer depends on the nature of std::set<SomeType>::iterator
type. If it is a user-defined type (i.e. a class with overloaded operators), then the behavior of iter = ++iter
is defined ans is indeed equivalent to a mere ++iter
. However, if std::set<SomeType>::iterator
is a built-in type, then iter = ++iter
produces undefined behavior, since it modifies the same object twice in one expression without an intervening sequence point (violation of the requirements presented in 5/4 of the language standard).
So, theoretically in general case one should avoid doing something like that since in general case the behavior is undefined. In practice though std::set<SomeType>::iterator
will normally be a user-defined type and iter = ++iter
will work. Nevertheless this is not a reason to use such expressions in the code.