https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98473
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Borislav Stanimirov from comment #2) > (In reply to Jonathan Wakely from comment #1) > > > To meet the requirements of the standard we would need to insert them at the > > end and then use std::rotate to reposition them. > > Or, to save move assignments, first "make a hole" and then copy-construct > b's in place (some destructors of moved-out objects) will have to be called. If any of those copy constructions throws then you have a vector with holes in it, breaking the invariant. Making that exception safe makes the code more complicated (and slower) which is why inserting them at the end and rotating is a better choice.