Template detection

Alexandru Ermicioi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 22 09:11:58 PDT 2015


On Tuesday, 22 September 2015 at 15:37:32 UTC, Meta wrote:
> On Sunday, 13 September 2015 at 08:26:55 UTC, Alexandru 
> Ermicioi wrote:
>> Hello,
>>
>> Given:
>>
>> class SomeClass {
>>
>>     public {
>>         void someSimpleMethod() {}
>>
>>         template setOfTemplatedMethods(Type) {
>>             void templatedMethodOne() {}
>>             void templatedMethodTwo() {}
>>         }
>>     }
>> }
>>
>> Is there a way to detect at compile time if a member of 
>> class/struct is a template? (in the example above, if 
>> setOfTemplatedMethods is a template).
>
> You can use __traits(isTemplate, <symbol>).

Thx. Didn't know that there is such trait available.

On page http://dlang.org/traits.html it's not present.


More information about the Digitalmars-d-learn mailing list