How to dispatch a class function for an object accessed by handle?
wjoe
invalid at example.com
Fri Mar 6 17:54:37 UTC 2020
On Friday, 6 March 2020 at 15:19:39 UTC, Adam D. Ruppe wrote:
> 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.
Awesome! I read the docs up and down but I couldn't figure it
out. Thank you!
More information about the Digitalmars-d-learn
mailing list