The most awesome "forward to member" solution?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 3 16:55:00 PDT 2015
On 5/3/15 4:20 PM, Meta wrote:
> On Sunday, 3 May 2015 at 20:25:45 UTC, Andrei Alexandrescu wrote:
>> OK, here's what I have now - two templates that are self contained and
>> work well:
>>
>> The first uses opDispatch to dispatch to a member. The second is a
>> simple string function that generates the appropriate code. As
>> discussed the latter composes but the former doesn't.
>
> I can't picture what you're talking about. Could you post an example?
struct A
{
void fun(int);
}
struct B
{
A a;
mixin forwardToMember!(a, "fun");
}
struct C
{
B b;
mixin forwardToMember!(b, "fun");
}
Andrei
More information about the Digitalmars-d
mailing list