std::string is a class and the object of it doesn't store the content of the string directly.
It's implementation defined by for your case, for simplicity, you can understand it this way:
std::string has a member that stores the pointer(say ptr) to the actual data.
and
std::string s = "001";
would not point ptr to the address string of "001"; it would allocate memory and copy the string into that memory. Then when you do
s = "002";
it doesn't need to reallocate memory to store "002"; it just copy "002" to the memory that stores "001" previously.
This means, if you dump the raw data of the string, it does NOT change.
When you read back the string raw data, it would just restore the pointer that points to "002".
hope this helps.