C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 14 Jan 2026 11:47:36 +0000
On Wednesday, January 14, 2026, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Tuesday, 13 January 2026 15:50:02 Pacific Standard Time Frederick
> Virchanza
> Gotham via Std-Proposals wrote:
> > No actually it's a bit longer than that:
> >
> > if ( decltype(auto) x = SomeFunction() ) return
> > !static_cast<decltype(x)>(x);
>
> Why are you casting x to x's type?
>
> And how often do you need to do that anyway?
>



Just in case SomeFunction returns an Rvalue reference

Received on 2026-01-14 11:47:39