How do I initialize a templated constructor?
jacobbauss at gmail.com
Mon Aug 8 08:27:49 UTC 2022
On Monday, 8 August 2022 at 07:37:16 UTC, rempas wrote:
> Thank you for all the great info! Unfortunately, while there is
> no problem in this example, this will
> not do for my real code as I need to have the argument in the
> constructor. Alternative, I have to
> change the design of the program completely....
Yeah I think the only template argument you can have for
constructors are `this` which will refer to things like the class
that inherited the current class etc. not sure what else, but you
can't really pass anything to it yourself unfortunately.
But I think if you end up with something where you need different
constructors with different type arguments then you're probably
designing your program in a "wrong" way to begin with.
More information about the Digitalmars-d-learn