C++ Logo

std-proposals

Advanced search

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

From: Mital Ashok <mital_at_[hidden]>
Date: Mon, 25 May 2026 08:06:34 +0100
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?
>

Received on 2026-05-25 07:07:13