I just started studying C++, but there is a thing that I don't fully understand: when you initialize a std::string variable with a string literal, like this:
std::string str = "some string";
We have the literal "some string", which is immutable.
Then we have the variable str that stores "some string" and is mutable. You can go there and append another string to it, change letters, etc.
The whole point is: when we initialize str with this literal, it does a modifiable copy of the literal to this variable? If so, that means that in memory, there are two spaces: one to the "some string" literal and another for the modifiable "some string"?
And, just to make it clear: a value is a literal just if it is hard-coded in the source code, is it not?
const std::string read_only_str = "read_only";