If and isType with arrays

DMon no at mail.com
Wed Oct 7 16:25:33 UTC 2020


Can isType be used as a condition in an if statement with arrays?

import std.stdio;
import std.traits;

void main()
{
     int[5] a = [1,2,3,4,5];

// Something like this:
     if (a == isType!(int[5]))
     {
         write("true");
     }

// This works:
     if (a[0] == isType!(int))
     {
         write("true");
     }
}


More information about the Digitalmars-d-learn mailing list