3 ms·
Isn't the __cap__ field available also inside the malloc block header, so couldn't this field be optimized out of the std::string implementation?
by amelius 7y ago
Isn't the __cap__ field available also inside the malloc block header, so couldn't this field be optimized out of the std::string implementation?
- thedance 7y agoNo. You can’t make assumptions about how global operator new works. Allocators like tcmalloc are allowed to override it. And string can be instantiated with any stl allocator, so it might never call ::new anyway.