opDispatch to template members

Phil Lavoie maidenphil at hotmail.com
Fri Dec 7 06:02:36 PST 2012


Hi,

Indeed as he suggested. I tried to reply that I was looking at 
the code yesterday and that it was what I was looking for, but my 
post did not get through for some reasons.

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