Trait to identify if a type is a struct one

user1234 user1234 at 12.nl
Wed Oct 18 17:05:51 UTC 2017


On Wednesday, 18 October 2017 at 15:16:21 UTC, drug wrote:
> 18.10.2017 18:11, pham пишет:
>> Is there a way to identify if a type is a struct, something 
>> like isStruct
>> similar to isArray.
>> 
>> struct X
>> {
>> }
>> 
>> isStruct!X == true?
>> 
>> Also, there are isAbstractClass & isFinalClass but want to 
>> check if type is a class regardless? something like isClass?
>> 
>> Thanks
>> Pham
>> 
> if (is(X == struct))
> {
>    ...
> }

static if (is(X == struct))
{
    ...
}

ptherwise lots of strnage errors ;)



More information about the Digitalmars-d-learn mailing list