Gültigkeit temporärer Objekte
-
std::string f(); void g(const char*); g(f().c_str());Ist der const char* in g() noch gültig? Sollte ja schon, da meines Wissens temporäre Objekte bis zum Ende des Ausdrucks existieren.
-
§ 12.2/3 schrieb:
Temporary objects are destroyed as the last step in evaluating the full-expression (1.9) that (lexically) contains the point where they were created.
-
N3337, [class.temporary]/3:
Temporary objects are destroyed as the last step
in evaluating the full-expression (1.9) that (lexically) contains the point where they were created.Edit: Mist, da kam mir jemand mit dem selben Zitat zuvor, als ich noch am Suchen war.
