(and yes, wrapping the string object rather than a reference to nowhere would make it right.. note that const data members are a little awkward to use, since they kill implicit assignment, I'd just have it std::string str;
Thank you for the reply. I found out that the reason why it worked, is because the original code was something like this:
1 2 3 4 5 6
// some code
Some_function_that_copies_data_members_values(MakeS("entry1"), MakeS("entry2"), ..., MakeS("entryN"));
// At this point all the temporaries are destructed, but not before the end of the function call.
// This is actually quite nice i guess, since there is very little copying involved.