More operators inside `is(...)` expressions
Steven Schveighoffer
schveiguy at gmail.com
Mon Aug 24 11:49:05 UTC 2020
On 8/24/20 4:03 AM, Timon Gehr wrote:
> On 23.08.20 23:08, Per Nordlöw wrote:
>> Why aren't more operators allowed inside `is(...)`-expressions?
>>
>> For instance
>>
>> if (!is(CommonType!(typeof(min), typeof(max)) == void))
>>
>> could be written as
>>
>> if (is(CommonType!(typeof(min), typeof(max)) != void))
>>
>> .
>
> So is(undefined != void) would be `true`? (Where `undefined` does not
> exist.)
Yes. If you write !is(T == void), then you are already not checking
whether T is defined. This is no different.
This literally is just a nicer way to write it, where the operation is
closer to the parameters, instead of partly outside the expression.
-Steve
More information about the Digitalmars-d
mailing list