Tag: temporary-objects
-
Is constructing an object in an argument list and passing a pointer to internal data of the object to the function safe?
8 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()); c++ string temporary-objects Share Improve this question Follow edited 9 hours ago Evg 25k55 gold badges3939 silver badges8383 bronze badges asked 11 hours ago BlueCannonBallBlueCannonBall 13311 silver badge33 bronze badges 4…