C++ Logo

std-discussion

Advanced search

Re: lambda, capture by const-ref

From: Federico Kircheis <federico.kircheis_at_[hidden]>
Date: Sat, 18 Sep 2021 09:54:47 +0200
On 18/09/2021 02.39, Thiago Macieira via Std-Discussion wrote:
> On Thursday, 16 September 2021 23:23:14 PDT Federico Kircheis via Std-
> Discussion wrote:
>> Because this is a trimmed down example.
>
> And this is the problem. You trimmed it down too much. That's why I was asking
> for a different case.
>
> I do think your idea has merit and, like Andrew, that it's a natural extension
> of what's already possible. I was just commenting that the motivation use-case
> needs improvement because you had a working, ideal solution for the content
> shown.
>

I see.

Is the example with storing the return value enough, or do you think it
is still trimmed down too much?

Even for other use-cases, writing the static_cast and hiding it in a
macro is less verbose and more expressive than introducing a new scope
or a second lambda (even less verbose than std::as_const...).

Received on 2021-09-18 02:58:27