Can anybody explain me below statement ?
Unsolved
C++ Gurus
-
I want to understand the below statement in terms of programming can any body help me ?
no need to extract a std::string from a std::stringstream when its only use is to get its content via c_str() -
Something like this:
std::stringstream ss("this is a string\n");
const std::string& tmp = ss.str();
const char* cstr = tmp.c_str();
std::cout << " ====== " << cstr << std::endl;
It may mean that you do not need a copy of the string when you need only c_str().