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

Alex sascha.orlov at gmail.com
Thu Sep 27 08:56:22 UTC 2018


On Wednesday, 26 September 2018 at 20:41:38 UTC, Chad Joan wrote:

> class Root(T)
> {
> 	T x;
> }
>
> class Extended(T) : Root!T
> {
> 	T y;
> }
>

Sorry for a technical aside, but would this be something for you?
https://forum.dlang.org/post/vtaxcxpufrovwfrkbyye@forum.dlang.org

I mean... In either case, there is something curious in the 
Extended/Root usage, as they both are bound to the same type. And 
if so, you could get rid of the templatization in the Extended 
class, either by templating Root on the Extended or use the T of 
Root in Extended.


More information about the Digitalmars-d-learn mailing list