How to dispatch a class function for an object accessed by handle?

Adam D. Ruppe destructionator at gmail.com
Fri Mar 6 15:19:39 UTC 2020


On Friday, 6 March 2020 at 15:05:56 UTC, wjoe wrote:
> But didn't like the string part and that's when I introduced 
> the alias fn because I figured maybe it's possible to do 
> something like:
>   factory.dispatch!(Bitmap.load)(handle, path);
> and get the Bitmap part from that alias and hence save the 
> duplicate Bitmap type in factory.dispatch!(Bitmap, 
> Bitmap.load)(...);

ooh you can do that. on the alias, use __traits(identifier) to 
get thef ucntion name and __traits(parent) to get the class name! 
then it reduces to what we already wrote.


More information about the Digitalmars-d-learn mailing list