Check type is a struct at compile time?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 6 15:25:19 PST 2014


On Friday, December 05, 2014 20:38:30 Gary Willoughby via Digitalmars-d-learn wrote:
> How can i check that a type is a struct at compile time? I know i
> can test for a class like this:
>
> static if(is(T == class))
> {
>      ...
> }
>
> But how to do the same thing for a struct?

static if(is(T == struct))
{
}

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list