I am just curious about this:
std::string s(10);
It doesn't work. I would like to know the reason why it doesn't make a string with 10 elements. This is probably an easy question but I can't figure it out.
I am just curious about this:
std::string s(10);
It doesn't work. I would like to know the reason why it doesn't make a string with 10 elements. This is probably an easy question but I can't figure it out.
std::string
has many constructors.
If You want a string with an explicit length, then a character has to be specified which will be used to fill this string:
std::string s(10, ' ');