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 09:11:34 +0200
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?   -----Ursprüngliche Nachricht----- Von:Mital Ashok via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Mo 25.05.2026 09:07 Betreff:Re: [std-proposals] Perfect forwarding for prvalues / expression templates An:std-proposals_at_[hidden]; CC:Mital Ashok <mital_at_[hidden]>; The advantages are extreme ease of use and a 'standardized' way to forward prvalues to a function. This would mean more generic libraries (including the standard library) would adopt it, leading to less copies/moves, support for more complicated initializers to emplace-style functions (`vec.emplace_back_lazy({ .x = ..., .y = ... })` without a move constructor), and easy support of immovable classes that were previously very difficult to 'emplace' into a container. If the lambda solution was treated in a more first-class way, we would see it being used more instead of macros for things like assert/log and would be supported on container types in general. On Mon, 25 May 2026 at 07:39, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote: > > What are the advantages in comparison to a lambda? > -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-05-25 07:14:26