How do I filter out this type?
Dr.No
jckj33 at gmail.com
Fri Jun 22 17:07:31 UTC 2018
In the below code, "A[] found" is never printed. What's the
proper way to check for this type?
import std.stdio;
import std.traits : FieldNameTuple;
class A { }
class B
{
string foo;
string baa;
A[] list;
}
void main()
{
static foreach(field; FieldNameTuple!B)
{
static if(is(typeof(__traits(getMember, B, field) == A[])))
{
writeln("A[] found");
}
}
writeln("done");
}
More information about the Digitalmars-d-learn
mailing list