RFC: Allow moved-from strings to be non-empty

Joe Buck joe.buck@synopsys.com
Sat Oct 27 05:19:00 GMT 2018


The reason move constructors were introduced was to speed up code in cases where an object
Is copied and the copy is no longer needed.  It is unfortunate that there may now be code out
there that relies on accidental properties of library implementations.  It would be best if the
Implementation is not constrained.  Unless the standard mandates that, after a string is moved,
the string is empty, the user should only be able to assume that it is in some consistent but
unspecified state.  Otherwise we pay a performance penalty forever. 

If the standard explicitly states that the argument to the move constructor is defined to be
empty after the call, we're stuck.



More information about the Gcc-patches mailing list