3 ms·
> One of its unusual design decisions is that the array's length and capacity is stored next to the array elements itself. GNU stdlibc++ does this for std::str
by nly 12y ago
> One of its unusual design decisions is that the array's length and capacity is stored next to the array elements itself.
GNU stdlibc++ does this for std::string so you get prettier output in the debugger. The object itself only contains a char*.
- byuu 12y agoSeems like that would prevent small string optimization (a union of a small char array and the heap char pointer.) That lets me store about 85% of the strings in my assembler without any heap allocation, and is a huge win in my book.
- nly 12y agoIndeed, they don't do SSO. Reference counted COW, which violates the standard.