The current code will reallocate in place if it can, otherwise it has to move the memory. Isn't that the exact same thing as your snippet above?