Compare type with another at CT
Adam D. Ruppe
destructionator at gmail.com
Thu Jan 23 08:23:28 PST 2014
On Thursday, 23 January 2014 at 16:21:39 UTC, Frustrated wrote:
> static if (T is A)
Try:
static if(is(T : A)) {}
The is() thingy is different than the is operator. T:A means "T
implicitly converts to A", so if T is a class implementing
interface A, that would pass.
There's also is(T == A) if you want a more specific check, as
well as IIRC 5 other forms of the is() thing which get weirder
but all do a specific task.
More information about the Digitalmars-d-learn
mailing list