https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81476
--- Comment #17 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #14) > The advantage of doing it as in comment 13, rather than: > [comment #11] > is that when inserting the inputrange causes reallocations we only have to > transfer the already inserted elements of the inputrange to the new storage, > not the elements preceding the insertion point ("the beginning of the > vector" and "what we already inserted at the end"). I see what you mean. Note that as soon as there is some reallocation going on at any point, we should be able to avoid calling (in-place) rotate, which is quite a bit more expensive than a simple range move.