Date: Tue, 13 Jan 2026 23:50:02 +0000
On Tue, Jan 13, 2026 at 11:28 PM Thiago Macieira wrote:
>>
> > return ! if SomeFunction();
> >
> > which would become:
> >
> > if ( decltype(auto) x = SomeFunction() ) return !x;
>
> What's the motivation for this syntactic sugar? It's saving four words
> (decltype, auto, and the variable name twice).
No actually it's a bit longer than that:
if ( decltype(auto) x = SomeFunction() ) return
!static_cast<decltype(x)>(x);
decltype, auto, static_cast, decltype, and the variable name three times
>>
> > return ! if SomeFunction();
> >
> > which would become:
> >
> > if ( decltype(auto) x = SomeFunction() ) return !x;
>
> What's the motivation for this syntactic sugar? It's saving four words
> (decltype, auto, and the variable name twice).
No actually it's a bit longer than that:
if ( decltype(auto) x = SomeFunction() ) return
!static_cast<decltype(x)>(x);
decltype, auto, static_cast, decltype, and the variable name three times
Received on 2026-01-13 23:49:00
