This might be off-topic since there is no code, no output, no anything, but here goes.
The only way I see C++ can know "this"
is a std::string
is because the quotation mark is a language construct, much like the char
between single quotes.
But I would be really surprised if it was the actual answer: does that imply std::string
is the only way C++ has to interpret text between quotation marks? Then the standard lib would not be just an extension, but a part of C++.
What if I want to develop my own MyString
class, and I want to create MyStrings
on the fly using quotation marks: would I be able to do it or is the ""
syntax inevitably linked to the std::string
?
I also thought about ""
being an operator (after all C++ has operator()
), but I couldn't find anything about that.