traits getOverload of a template method

ZombineDev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 26 08:06:18 PST 2016


On Thursday, 6 February 2014 at 23:06:03 UTC, QAston wrote:
> How do i get aliases to overloads of a template method like
>
> Class A
> {
>     int a(T)(T tq,T tw);
>     int a(T)(T tq);
> }
> __traits(getOverloads, A, "a(int)")doesnt work

Bump. I also have a similar problem. I have a module with two 
function templates that are overloaded (they have the same name, 
but different sets of parameters) and I need to select one of 
them so I can cast it to a function with the @nogc attribute, 
similar to this: http://p0nce.github.io/d-idioms/#Bypassing-@nogc.

```
// move has two overloads: `T move(T)(ref T)` and `void 
move(T)(ref T, ref T)`
// and I need to select the second one here:
cast(FT)(move!int)(arg1, arg2)

```
Otherwise I get "Error: template std.algorithm.mutation.move 
matches more than one template declaration".


More information about the Digitalmars-d-learn mailing list