template ref parameter
Jack Applegame
japplegame at gmail.com
Wed Nov 21 05:03:30 PST 2012
> alias void function(ref int) funcType;
>
> void foo(ref int a) { a--; }
>
> struct functor(A...) {
> A[0] func;
> }
> void main()
> {
> functor!funcType f;
> f.func = &foo;
> }
I think the best way is using @property.
alias void function(ref int) funcType;
void foo(ref int a) { a--; }
struct functor(A...) {
@property void func(A fp) { m_func = fp; }
A m_func;
}
void main()
{
functor!funcType f;
f.func = &foo;
}
More information about the Digitalmars-d-learn
mailing list