An issue with setting delegates via templates

2011-10-25 Thread Andrej Mitrovic
class Foo { void func(double) { } void func(int) { } void set(T)(T handler) { dg = handler; } void delegate(int) dg; } void main() { auto foo = new Foo; foo.set(&foo.func); // NG, func(double) is picked up first } Error: cannot implicitly convert expression (handler) of

Re: An issue with setting delegates via templates

2011-10-27 Thread Christophe
Andrej Mitrovic , dans le message (digitalmars.D.learn:30286), a écrit : > class Foo > { > void func(double) { } > void func(int) { } > > void set(T)(T handler) { dg = handler; } > void delegate(int) dg; > } > > void main() > { > auto foo = new Foo; > foo.set(&foo.func);

Re: An issue with setting delegates via templates

2011-10-27 Thread Andrej Mitrovic
So it seems this is an issue with a newer signals implementation. The old one works: import std.signals; struct Foo { mixin Signal!(int) sig; } class Bar { void x(string) { } void x(int) { } } void main() { Foo foo; auto bar = new Bar; foo.sig.connect(&bar.x); foo.si

Re: An issue with setting delegates via templates

2011-11-02 Thread Christophe Travert
Andrej Mitrovic , dans le message (digitalmars.D.learn:30315), a écrit : > The new one: https://gist.github.com/1194497 > > I'll investigate this further then. OK, so there is indeed a filter to find a suitable delegate to load: @trusted T connect(T)(T handler) if(isHandler!(T, Types)); But onl