Thread overview | |||||
---|---|---|---|---|---|
|
November 21, 2007 determine if X is a template | ||||
---|---|---|---|---|
| ||||
is there any way to determine if an identifier is a template, and how many parameters it has? i'm doing a multimethods kind of thing to see if you can simulate virtual template functions... |
November 21, 2007 Re: determine if X is a template | ||||
---|---|---|---|---|
| ||||
Posted in reply to BC | On Wed, 21 Nov 2007 14:34:46 -0000, BC <NOTmi_emayl_adrez@hotmail.com.remove.not> wrote: > is there any way to determine if an identifier is a template, and how many parameters it has? > > i'm doing a multimethods kind of thing to see if you can simulate virtual template functions... oh i figured it out, is(Templ) returns false and is(Templ!(int)) returns true if Templ takes one type argument |
November 21, 2007 Re: determine if X is a template | ||||
---|---|---|---|---|
| ||||
Posted in reply to BC | BC wrote:
> On Wed, 21 Nov 2007 14:34:46 -0000, BC <NOTmi_emayl_adrez@hotmail.com.remove.not> wrote:
>
>> is there any way to determine if an identifier is a template, and how many parameters it has?
>>
>> i'm doing a multimethods kind of thing to see if you can simulate virtual template functions...
>
> oh i figured it out, is(Templ) returns false and is(Templ!(int)) returns true
> if Templ takes one type argument
Note there are other types of template parameters.
I don't think the check above will catch these templates:
template Templ(int x) { ... } // or float or string or ...
or
template Templ(alias x) { ... }
--bb
|
Copyright © 1999-2021 by the D Language Foundation