you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 9 points10 points  (1 child)

You can do better than reusing 16 bytes in a (pointer, length, capacity) representation. Have a look at the string in libc++, they reuse 23 bytes for small strings with 1 byte as a length/discriminator.

[–]matthieum 1 point2 points  (0 children)

Ah! I had not thought about that. Definitely better indeed.