C++ Logo

std-proposals

Advanced search

Re: [std-proposals] lambda capture rules are too simplistic

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 25 Sep 2022 09:27:32 -0400
On Sun, Sep 25, 2022 at 4:11 AM blacktea hamburger via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> P0588R0 contains the rationale explaining why the rules for implicit capture were changed in order to capture some variables that are not going to be odr-used anyway.
>
> However, it makes the rules too simplistic.
>
> For non-generic lambda, the paper says "Note that we propose applying this treatment uniformly to both generic and non-generic lambdas (this is not essential to the proposal, but seems to give a more consistent language rule)." This consistency is useless. It does ease the workload for some language-lawyers, but the impact on the average developers is redundant captures.

Can you give an example of where these "redundant captures" would
happen in non-generic lambdas?

Received on 2022-09-25 13:28:31