GCC has moved away from the refcounted line to follow the C ++ 11 standard, but note that it is possible that your program will use it as part of its ABI compatibility implementation.
How is it counted
std::string does not have a member _Rep_Base , but a pointer to _Rep with _Rep inheriting from _Rep_Base
This is explained here:
* Where the _M_p points to the first character in the string, and * you cast it to a pointer-to-_Rep and subtract 1 to get a * pointer to the header.
The buffer lies after the header ...
Yes, but after the header of the _Rep object, and your line only has a pointer to it.
source share