Pattern matching is-expressions

Dennis dkorpel at gmail.com
Wed Aug 19 13:27:34 UTC 2020


On Wednesday, 19 August 2020 at 13:14:22 UTC, Stefan Koch wrote:
> On Wednesday, 19 August 2020 at 13:03:59 UTC, Dennis wrote:
>  Also they are not
>> complete (there is trait for checking if something is an enum),
> The expression is(T == enum) works, and does detect if 
> something has an enum type.
> Are you talking about detecting a manifest constant?

I meant to say "there is *no* trait for checking if something is 
an enum" (in __traits() or std.traits), so you still have to use 
an is expression there. My point is that is is-expressions are 
basically a swiss army knife for all type identification, while 
__traits and std.traits are more like swiss cheese (you can 
identify some types, but others you can't).


More information about the Digitalmars-d mailing list