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

Jonathan Wakely jwakely@redhat.com
Fri Oct 26 09:57:00 GMT 2018


On 26/10/18 08:25 +0200, Marc Glisse wrote:
>On Fri, 26 Oct 2018, Jonathan Wakely wrote:
>
>>>For the libc++ string zeroing the length of a small string happens to
>>>be faster.
>
>Ah, yes, of course.
>
>>>>Is it? In debug mode, I'd be tempted to leave the string as 
>>>>"moved" (size 5, short string so there is no allocation).
>>>
>>>That's not a bad idea.
>>
>>Although we can't do it for std::wstring and std::u32string, as their
>>small string buffer is *very* small.
>
>"N/A"? The proposition was only semi-serious.
>
>By the way, I was surprised by the formula for the size of the buffer. 
>It often has size 16, but for a _CharT of size 3 and alignment 1 
>(unlikely I guess), it has size 18.

Oops, that's not intentional.



More information about the Libstdc++ mailing list