Date: Sat, 1 Oct 2022 09:29:43 -0400
On Sat, Oct 1, 2022 at 8:41 AM blacktea hamburger via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> You have a point.
>
> But for non-generic lambdas, there should be no additional capture. Such as:
>
> const int n = 1;
> [=] {int arr[n];};
Where is the "additional capture"?
Your lambda asked to capture everything if it is mentioned. I see `n`
being mentioned in the lambda body. It is not at all unreasonable for
a lambda to capture it. And a compiler can always optimize it away,
but there's no problem with having `n` be captured.
<std-proposals_at_[hidden]> wrote:
>
> You have a point.
>
> But for non-generic lambdas, there should be no additional capture. Such as:
>
> const int n = 1;
> [=] {int arr[n];};
Where is the "additional capture"?
Your lambda asked to capture everything if it is mentioned. I see `n`
being mentioned in the lambda body. It is not at all unreasonable for
a lambda to capture it. And a compiler can always optimize it away,
but there's no problem with having `n` be captured.
Received on 2022-10-01 13:30:57