Date: Tue, 13 Jan 2026 18:02:48 +0000
On Tuesday, January 13, 2026, Thiago Macieira wrote:
>
>
> if (decltype(auto) x = SomeFunction()) return !x;
>
I've used "decltype(auto)" as the return type of a function but not like
this.
Anyway it would be more readable as:
return false if SomeFunction();
In this context the 'false' really means 'inverted'. I don't know if that
would bug people too much.
I do realise that I'm not adding any functionality to the language; this is
just about readability and convenience. Sort of like how we can now do:
auto [ a, b ] = Func();
instead of:
auto mypair = Func();
auto &a = mypair.first;
auto &b = mypair.second;
No new functionality added but it's handy and looks nice.
>
>
> if (decltype(auto) x = SomeFunction()) return !x;
>
I've used "decltype(auto)" as the return type of a function but not like
this.
Anyway it would be more readable as:
return false if SomeFunction();
In this context the 'false' really means 'inverted'. I don't know if that
would bug people too much.
I do realise that I'm not adding any functionality to the language; this is
just about readability and convenience. Sort of like how we can now do:
auto [ a, b ] = Func();
instead of:
auto mypair = Func();
auto &a = mypair.first;
auto &b = mypair.second;
No new functionality added but it's handy and looks nice.
Received on 2026-01-13 18:02:51
