更新时间:2022-11-16 23:00:12
这是在12.2 / 3:
This is in 12.2/3:
临时对象作为评估(词法)包含创建点的完整表达式(1.9)的最后一步被销毁。
Temporary objects are destroyed as the last step in evaluating the full-expression (1.9) that (lexically) contains the point where they were created.
您的行为得到保证。
有两个条件,如果满足,将延长临时生命周期。第一个是当它是一个对象的初始化时。第二个是当引用绑定到临时。
There are two conditions that, if met, will extend the lifetime of a temporary. The first is when it's an initializer for an object. The second is when a reference binds to a temporary.