std.signals Can not connect a delegate without in Object

Dsby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 29 00:33:59 PDT 2016


import std.signals;
import std.stdio;



class hh
{
      mixin Signal!();

     void haha(){emit();}
}


class ff
{
     void show()
     {
         writeln("ff show");
     }
}

void main()
{

     auto h = new hh();

     void show()
     {
         writeln("main show");
     }

     auto f = new ff();

    // h.connect(&f.show); // It is ok to work
     h.connect(&show); // will Segmentation fault 。

     h.haha();

}





More information about the Digitalmars-d-learn mailing list