Disturbing order of evaluation
问题 When I work with my favorite containers, I tend to chain operations. For instance, in the well-known Erase–remove idiom: v.erase( std::remove_if(v.begin(), v.end(), is_odd), v.end() ); From what I know of the order of evaluation, v.end() (on the rhs) might be evaluated before the call to std::remove_if . This is not a problem here since std::remove* only shuffle the vector without changing its end iterator. But it could lead to really surprising constructs, like for instance (demo): #include