function cannot access frame
Johnson Jones via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 20 21:25:54 PDT 2017
cannot access frame of function
I declared a helper function outside a lambda that is passed to C.
The semantics are the same inside of the function as they are
outside as far as code goes.
How can I declare a function that essentially works inside the
lambda also without having to do any real rewriting?
e.g., if I could use a define
#define foo(a,b) a + b
would work great, that is all I really need, templates have the
same issue as functions though.
To make it work I used a mixin template, but that seems a bit
obtuse ;/
e.g.,
template put()
{
int foo(a,b) { return a + b; }
}
mixin put;
then I mixin it inside the lambda also. That way I have both
contexts covered, not bad but...
More information about the Digitalmars-d-learn
mailing list