pointers-to-members, (custom) array implementation
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Feb 8 02:09:02 PST 2007
Jarrett Billingsley wrote:
> I was hoping it might be possible to use mixin() to create an arbitrary
> identifier, but unfortunately:
>
> c.mixin("one")(i);
>
> doesn't compile.
Try these (off the top of my head):
---
int Pt2Mem!(char[] go)(C c, int i)
{
return mixin("c." ~ go ~ "(i)");
}
---
or:
---
int Pt2Mem!(char[] go)(C c, int i)
{
mixin("return c." ~ go ~ "(i)");
}
---
IIRC you can only mixin complete expressions, statements or
declarations[1]. Declarations aren't really useful here, but expressions
and statements should work...
[1]: Well, and templates, but that doesn't work with strings.
More information about the Digitalmars-d
mailing list