Check if type is from specific template?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 29 04:58:46 PST 2015


On Thursday, 29 January 2015 at 12:10:41 UTC, bearophile wrote:
> Tofu Ninja:
>
>> Basically what the title says, how do I check if a type T is 
>> an instantiation of a specific template?
>
> If you have an updated Phobos std.traits.isInstanceOf could be 
> what you look for.
>
> Bye,
> bearophile

Yep, exactly what I needed.

Incidentally, while trying to see how its used I found that a lot 
of the links on the std.traits doc page do not work and have no 
documentation. For instance 
http://dlang.org/phobos/std_traits.html#isInstanceOf does not 
actually appear on the page but has a link to it up in the 
navigation header.

Other links on that page that don't work...
isAssignable, isBoolean, isIntegral, isFloatingPoint, isNumeric, 
isScalarType, isBasicType, isUnsigned, isSigned, isSomeChar, 
isSomeString, isNarrowString, isStaticArray, isDynamicArray, 
isArray, isAssociativeArray, isBuiltinType, isPointer, 
isAggregateType, isIterable, isMutable, isInstanceOf, unsigned

It seems that all the variable template's docs are not getting 
generated...


More information about the Digitalmars-d-learn mailing list