www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Check if type is from specific template?

reply "Tofu Ninja" <emmons0 purdue.edu> writes:
Basically what the title says, how do I check if a type T is an 
instantiation of a specific template?
Jan 29 2015
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jan 29 2015
parent reply "Tofu Ninja" <emmons0 purdue.edu> writes:
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...
Jan 29 2015
parent "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Thu, Jan 29, 2015 at 12:58:46PM +0000, Tofu Ninja via Digitalmars-d-learn
wrote:
[...]
 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.
[...] Please file bugs for these. We need to fix the docs. T -- "I speak better English than this villain Bush" -- Mohammed Saeed al-Sahaf, Iraqi Minister of Information
Jan 29 2015