C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 13 Jan 2026 17:31:36 -0800
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?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-14 01:31:37