traits getOverload of a template method

Timoses timosesu at gmail.com
Mon Sep 10 12:57:25 UTC 2018


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

Is there any way to "select" overloaded template functions?

I require to select one of `std.bitmanip.peek`

     import std.bitmanip : peek;
     import std.system : Endian;
     alias myPeek = peek!(int, Endian.bigEndian, 
immutable(ubyte)[]);

Error:
template std.bitmanip.peek matches more than one template 
declaration:
/dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(3269):     
peek(T, Endian endianness = Endian.bigEndian, R)(R range) if 
(canSwapEndianness!T && isForwardRange!R && is(ElementType!R : 
const(ubyte)))
and
/dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(3306):     
peek(T, Endian endianness = Endian.bigEndian, R)(R range, size_t* 
index) if (canSwapEndianness!T && isForwardRange!R && 
hasSlicing!R && is(ElementType!R : const(ubyte)))

How to "select" one?


More information about the Digitalmars-d-learn mailing list