std.signal woes :/

Damian damianday at hotmail.co.uk
Mon Feb 25 01:50:15 PST 2013


On Sunday, 24 February 2013 at 19:20:06 UTC, cal wrote:
> On Sunday, 24 February 2013 at 17:30:14 UTC, Damian wrote:
>> That solution is ok for 1 argument but for many arguments it 
>> wont suffice.
>>
>> This is issue 5028.
>
> What is the problem with many arguments? I'm probably 
> misunderstanding, but e.g. this works:
>
> struct MySignal(T...)
> {
>     mixin Signal!T _signal;
>     alias _signal this;
> }
>
> class A
> {
>     MySignal!(float, int[]) sigA;
> }
>
> class B : A
> {
>     MySignal!(int, string, char) sigB;
> }
>
> void main()
> {
>     auto a = new A;
>     auto b = new B;
>     a.sigA.emit(1.4, [1,2,3]);
>     b.sigA.emit(1, [4,5,6]);
>     b.sigB.emit(1, "hello", 'x');
> }

Oooh I could of sworn I tried that.. it was late and I was 
defining
MySignal as a mixin still!! My bad! Your workaround does indeed 
work.
Thanks.


More information about the Digitalmars-d-learn mailing list