
14 Feb
2011
14 Feb
'11
10:55 p.m.
On 14/02/11 19:08, Scott McMurray wrote:
On Mon, Feb 14, 2011 at 01:53, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
SBO makes moving a string costly.
How bug a buffer does SBO usually use?
The libc++ string uses 23 bytes (on a 64-bit architecture) by squishing the length into a single byte for short strings. I don't see how that makes moves costly, though. The move constructor for this string simply copies the bytes and zeroes out the source; it doesn't even need to branch based on whether it's a long or short string. Perhaps the concern is that such techniques are not defined behaviour? Or that the use of unions might confuse the optimizer? John Bytheway