Is the C++ code below well-formed? Will the std::string
get destroyed before or after the function finishes executing?
void my_function(const char*);
...
my_function(std::string("Something").c_str());
I know I could do my_function("Something")
, but I am using std::string
this way to illustrate my point.