C++ Logo

std-proposals

Advanced search

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

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Mon, 25 May 2026 07:50:43 +0200
I understand the following is not the primary use-case,
but would work given the proposed facility:

On 5/25/26 07:12, Mital Ashok via Std-Proposals wrote:
> std::lazy<int> x = f(); // f is not called here
> return std::move(x)(); // f is called

The second line seems fine in isolation, but the first line appears
to change core language expression semantics simply via the presence
of a special library type used to specify the type of "x".

That's plain horrifying, both on an ergonomics level

  g(f()) // is f called here? maybe

and on an effort-for-specification level.

Jens

Received on 2026-05-25 05:50:46