template ref parameter

Jack Applegame japplegame at gmail.com
Wed Nov 21 04:02:45 PST 2012


How to implement functor-like objects if ref is storage class?

void foo(ref int a) { a--; }
struct functor(A...) {
   void function(A) functor;
}
functor!int f;    // functor!(ref int) - wrong
f.functor = &foo; // Error: cannot implicitly convert expression 
(& foo) of type void function(ref int a) to void function(int)



More information about the Digitalmars-d-learn mailing list