2 ms·
What? C++ strings have an overhead of 16 bytes+the space left in the backing buffer. That’s really not all that much.
by saagarjha 7y ago
What? C++ strings have an overhead of 16 bytes+the space left in the backing buffer. That’s really not all that much.
- compiler-guy 7y ago16 bytes is in no way guaranteed by the standard.
- saagarjha 7y agoOf course–the implementation is free to do whatever it likes. But all reasonable ones will either use a three pointer (or some combination of a base pointer and pointers/integers representation bounds) or include a small buffer for SSO that overlaps with the storage for heap bounds.