C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Perfect forwarding for prvalues / expression templates

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Mon, 25 May 2026 11:15:20 +0200
See Jens' reply (one of the first in the thread).   It probably went too frictionless.   OTOH How much is allowed under as-if rules?  - if the parameters are fully known, the implementation could shift around the evaluation in both directions?   -----Ursprüngliche Nachricht----- Von:Mital Ashok via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Mo 25.05.2026 09:40 Betreff:Re: [std-proposals] Perfect forwarding for prvalues / expression templates An:std-proposals_at_[hidden]; CC:Mital Ashok <mital_at_[hidden]>; On Mon, 25 May 2026 at 08:14, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote: > > The syntax of std::lazy makes it hard to recognize, which parts of the program are lazily evaluated. > > Is there a mixture of std::lazy and lambda syntax possible? The whole point is that it would be as frictionless as possible at the call site. The exact same issue appears currently with assert/debug/log macros, where we expect the macro writer to have sensible semantics about whether/how many times a macro argument is actually evaluated. This is currently extremely possible by just wrapping everything in a lambda, but no one is doing it because it isn't a known/standardized pattern and it is extremely verbose:    logger.log(log_level::info, [&]{ return std::format("f() called with argument {}", i); });    // Which leads people to use a macro    LOG_MACRO(logger, log_level::info, "f() called with argument {}", i);    // vs with std::lazy    logger.log(log_level::info, "f() called with argument {}", i); -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-05-25 09:18:09