template sequence parameters treats member functions differently?

aliak something at something.com
Sun Jun 24 21:19:03 UTC 2018


Hi, I'm having some issues with template sequence parameters, it 
seems they are not typed as delegates inside a template, but are 
outside. I.e.

template T(V...) {
     alias T = typeof(&V[0]);
}

struct S { void f() {} }
S s;

pragma(msg, T!(s.f)); // void function()
pragma(msg, typeof(&s.f)); // void delegate()

How come the output is different? Is it supposed to be the same?

What I'm trying to do is write a template that can give me a 
tuple of types for all values of the sequence passed in, so that 
I can index in to the type tuple. Seems to work well except for 
this member function part, working source here:

https://run.dlang.io/is/TBXHlY

Specifically the commented out line is what I would like to be 
able to get working if possible.

Thanks for any help,
- Ali





More information about the Digitalmars-d-learn mailing list