C++ Logo


Advanced search

Re: Lifetime Extending constructors

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 02 Jul 2021 09:04:46 -0700
On Friday, 2 July 2021 08:15:03 PDT connor horman via Std-Proposals wrote:
> If the
> constructor is invoked with a temporary argument in the position of the
> temporary, then the lifetime of that temporary is extended to match the
> lifetime of the object under construction

Does that include when new'ing such a type?

  new Type(reference_to_be_lifetime_extended);

Does it get extended for the lifetime of the dynamic type? And how does the
destructor know to end it?

PS: the usual discussion about whether this should be an attribute or a full
keyword is missing. Remember: a compliant implementation of an attribute is to
do nothing.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2021-07-02 11:04:52