Is this code correct and stable?
I am thinking about the const char* to const std::string& casting. I'm guessing a temporary string-object will be created, but what is it's lifetime?
Oh, well. I just want to know if i can do this safetly or not.
/Niklas AnderssonCode:void log(const std::string& text) { std::string wholeMessage = "Some text here"; wholeMessage += text; std::cout << wholeMessage << std::endl; } int main() { log("I'm i safe?"); return 0; }
Sweden




Reply With Quote