Trait for "can be instantiated"?

Salih Dincer salihdb at hotmail.com
Tue May 10 08:50:14 UTC 2022


On Tuesday, 10 May 2022 at 07:18:53 UTC, Salih Dincer wrote:
> But I still have a little more patience :)

It gives an error when the exclamation mark is removed, I have no 
objections. But typing long instead of char also gives an error!
```d
void main()
{
   alias T =  char;

   import std.traits;
   foreach(useableType; AllImplicitConversionTargets!(ulong))
   {  /* Except for four: long, float, double, real.
         The approval.//*/
   	assert(!is(T == useableType));
   }
    // No errors!
}
```
**Reference:** 
https://dlang.org/phobos/std_traits.html#AllImplicitConversionTargets

SDB at 79


More information about the Digitalmars-d-learn mailing list