Check if type is from specific template?

2015-01-29 Thread Tofu Ninja via Digitalmars-d-learn
Basically what the title says, how do I check if a type T is an 
instantiation of a specific template?


Re: Check if type is from specific template?

2015-01-29 Thread bearophile via Digitalmars-d-learn

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


Re: Check if type is from specific template?

2015-01-29 Thread Tofu Ninja via Digitalmars-d-learn

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...


Re: Check if type is from specific template?

2015-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 29, 2015 at 12:58:46PM +, 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