C++ Logo


Advanced search

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

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Sun, 25 Sep 2022 15:22:37 +0100
What about the `might_use` problem? That wouldn't be solved by your
proposed refinement.

On Sun, 25 Sep 2022, 09:11 blacktea hamburger via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> P0588R0 <https://wg21.link/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.
> For generic lambda, the rules can only apply to expressions in
> constexpr-if, and the condition of it depends on a generic lambda parameter.
> This is enough to solve the problem to be solved in the paper.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2022-09-25 14:22:51