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

Marc Glisse marc.glisse@inria.fr
Thu Oct 25 22:42:00 GMT 2018


On Fri, 26 Oct 2018, Ville Voutilainen wrote:

> I would rather not introduce a behavioral difference between us and
> libc++.

Why not? There are already several, and it helps find bugs. Maybe you 
could convince libc++ to change as well if you want to keep the behavior 
the same?

> It does slightly concern me that some users might
> actually semantically expect a moved-from string to be empty, even
> though that's not guaranteed, although for non-SSO cases
> it *is* guaranteed.

Is it? In debug mode, I'd be tempted to leave the string as "moved" (size 
5, short string so there is no allocation).

-- 
Marc Glisse



More information about the Libstdc++ mailing list