I am afraid it is a really stupid question but I do not get it. I’m contructing a std::string that contains a line feed (needed for further processing) this way:
std::string mystr=std::string("\n")
Amazingly mystr is empty afterwards. And when I step into the string-constructor the handed over data are empty too (so no \n contained). What is wrong here?
The string should not be empty, it should have size
1. What leads you to believe it is empty?output
1and0.What could be confusing you is a copy elision or a move construction in this expression:
which one would normally write like this anyway: