C++ Logo

std-proposals

Advanced search

Re: [std-proposals] if !(condition)

From: Jan Schultke <janschultke_at_[hidden]>
Date: Sat, 20 Apr 2024 18:31:41 +0200
"if not" has been proposed before and rejected, albeit with a
different motivation:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1181r0.html

The main issue here is whether it should behave exactly as if the
parentheses were omitted, or whether it should behave like "if (...)
{} else { ... }". Whether the "!" is actually applied here makes a
difference for types with an overloaded ! operator, such as tri-bool.

Since there is significant complication to the language and the
benefit is extremely minor, such "if not" proposals don't make much
sense.

Received on 2024-04-20 16:31:56