Check if a type is an instantiation of a template
- by Pedro Lacerda
I have structs like
struct RGBA (T) {/* ... */}
struct BMPFile (DataT) if (is(DataT == RGBA)) {/* ... */}
But is(DataT == RGBA) cannot work because DataT is a type and RGBA is a template. Instead I need check if a type is an instantiation of a template in order to declare file like
BMPFile!(RGBA!ushort) file;
In a comment @FeepingCreature showed
struct RGBA(T) {
alias void isRGBAStruct;
}
struct BMPFile (DataT) if (is(DataT.isRGBAStruct)) {}
Although to be working I have no tips on alias void isRGBAStruct.