opDispatch to template members

Phil Lavoie maidenphil at hotmail.com
Fri Dec 7 07:45:35 PST 2012


Hi,

Yes indeed Kenji pointed me in the right direction. I tried 
posting that I looked at the code he suggested and found what I 
was looking for, but I had some issue posting :(.

Thanks



On Friday, 7 December 2012 at 07:57:09 UTC, Jacob Carlborg wrote:
> On 2012-12-06 22:49, Phil Lavoie wrote:
>> I mean automatically dispatch to template members, not doing 
>> it in a
>> case by case fashion (using template if clauses for example).
>>
>> Thanks
>
> As Kenji said, doing something like this:
>
> struct Outer {
>   private Inner _inner;
>
>   template opDispatch( string method ) {
>     auto opDispatch (T... ) (T args)
>       return mixin( "_inner." ~ method )( args );
>     }
>   }
> }



More information about the Digitalmars-d mailing list