История изменений
Исправление
pavlick,
(текущая версия)
:
Ну это я читал, продливать жизнь можно лишь один раз - при первой привязки prvalue к ссылке. А про копирование ссылок сказано следующее:
In general, the lifetime of a temporary cannot be further extended by «passing it on»: a second reference, initialized from the reference to which the temporary was bound, does not affect its lifetime.
Вроде вопросов быть и не должно, но компиляторы ведь не ругаются.
ЗЫ: т.е. prvalue должен умереть после смерти (S &&)
Исправление
pavlick,
:
Ну это я читал, продливать жизнь можно лишь один раз - при первой привязки prvalue к ссылке. А про копирование ссылок сказано следующее:
In general, the lifetime of a temporary cannot be further extended by «passing it on»: a second reference, initialized from the reference to which the temporary was bound, does not affect its lifetime.
Вроде вопросов быть и не должно, но компиляторы ведь не ругаются.
Исходная версия
pavlick,
:
Ну это я читал, продливать жизнь можно лишь один раз - при первой привязки prvalue к ссылке. А про копирование ссылок сказано следующее:
In general, the lifetime of a temporary cannot be further extended by «passing it on»: a second reference, initialized from the reference to which the temporary was bound, does not affect its lifetime.