template ref parameter

Jack Applegame japplegame at gmail.com
Wed Nov 21 04:51:26 PST 2012


This problem appears also in std.signals.
There is no possibility to use functions with ref parameters as 
signal handler.

import std.signals;

class Foo {
   mixin Signal!(int);
}
class Bar {
   void handler(ref int a) {}
}

void main() {
   Foo foo = new Foo;
   Bar bar = new Bar;
   foo.connect(&bar.handler);
}

outputs:
Error: function signals.Foo.Signal!(int).connect (void 
delegate(int) slot) is not callable using argument types (void 
delegate(ref int a))|
Error: cannot implicitly convert expression (&bar.handler) of 
type void delegate(ref int a) to void delegate(int)




More information about the Digitalmars-d-learn mailing list