template ref parameter
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Nov 21 06:45:06 PST 2012
On 11/21/12, Jack Applegame <japplegame at gmail.com> wrote:
> 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);
> }
Known problem, no known proposals or solutions. But there are
workarounds, e.g. if you're writing your own signals implementation
you could use a function type instead of a lone type, e.g.:
mixin Signal!(void function(ref int));
More information about the Digitalmars-d-learn
mailing list