Is there a way to use Object.factory with templated classes? Or some way to construct templated classes given RTTI of an instance?

Chad Joan chadjoan at gmail.com
Thu Sep 27 18:51:33 UTC 2018


On Thursday, 27 September 2018 at 13:23:15 UTC, Adam D. Ruppe 
wrote:
> On Thursday, 27 September 2018 at 05:04:09 UTC, Chad Joan wrote:
>> As above, I think this might be a very clean and effective 
>> solution for a different class of use-cases :)  I'll keep it 
>> in mind though.
>
> Yeah. And I did make one mistake: the tupleof assignment trick 
> wouldn't work well for references, so lol it isn't much of a 
> deep copy. You'd want to deep copy any arrays too probably.
>
> But sounds like you are already doing that, yay.

You're right though, if I end up adding boilerplate anyways, I 
may as well have a good shallow copy to begin with.


More information about the Digitalmars-d-learn mailing list