Is it possible to do this with a template?

rempas rempas at tutanota.com
Fri Dec 17 21:36:22 UTC 2021


On Friday, 17 December 2021 at 16:02:45 UTC, RazvanN wrote:
>
> There is also a compiler trait [1] which can do that for you:
>
> ```d
> void main()
> {
>     int val = 10;
>     static if (__traits(isSame, typeof(val), int)) {}
> }
> ```
>
>
> [1] https://dlang.org/spec/traits.html#isSame

Thanks! The other options were simpler and faster to type tho


More information about the Digitalmars-d-learn mailing list