C++ Logo

std-proposals

Advanced search

Re: Named return values revival

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 28 Mar 2021 18:00:20 -0400
It should be noted that neither set of code that you presented
constitutes a dangling reference. The temporary manifested by the
default argument will be created by the caller of the function. As
such, the lifetime of that temporary is defined by the location of the
function call, *not* the boundaries of the function scope.

As such, it is unclear what exactly you want to change about the
language. It's also unclear why you would want to write code this way
instead of just returning the string and letting the *user* call the
function.

Received on 2021-03-28 17:00:34