How to define variadic delegate with a ref/out argument?

pham home at home.com
Fri Nov 17 05:08:23 UTC 2017


struct DelegateList(Args...)
{
public:
     alias DelegateHandler = void delegate(Args args) nothrow;

     DelegateHandler[] items;

     void opCall(Args args) nothrow
     {
         foreach (i; items)
             i(args);
     }
}

DelegateList!(string, int) list; // Compile OK so far
DelegateList!(string, int*) list2; // Compile OK so far
DelegateList!(string, ref int) list3; // Compile error -> How to 
make it work?

Thanks
Pham


More information about the Digitalmars-d-learn mailing list