C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 13 Jan 2026 20:06:12 +0200
On Tue, 13 Jan 2026 at 20:02, Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> 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.

That quite clearly should mean that the function returns false if
SomeFunction() returns true, not that there's some
inversion of SomeFunction's return value going on.

Received on 2026-01-13 18:06:25