I
Inso Reiges
Hi,
I`m not a native english speaker, so please bear with me.
I`ve inherited a template library codebase. This library is using a
mixin approach and passes a concrete class type down the inheritance
tree in template parameter, as such:
template <class T> class Base {};
template <class T> class Der1 : public Base<T> {};
.....
template <class T> class DerN : public DerN_minus_1<T> {};
The given hierarchy is simplified and uses multiple inheritance in
real code.
I have to make concrete (non-templated) classes on top of this
hierarchy:
class C1 : public DerN<C1> {};
class C2 : public DerN<C2> {};
....
Now, i have a collector class, that has to register all those C
classes somewhere inside it, like this:
class Collector { private: std::list<SomeType> mylist; };
But, as you know, i can not use templates for SomeType, because
compiler needs a concrete type. But i have to register C classes in a
single collection and C classes have to be on top of the template
inheritance hierarchy.
Could you please advise a solution?
Thank you, Inso Reiges.
I`m not a native english speaker, so please bear with me.
I`ve inherited a template library codebase. This library is using a
mixin approach and passes a concrete class type down the inheritance
tree in template parameter, as such:
template <class T> class Base {};
template <class T> class Der1 : public Base<T> {};
.....
template <class T> class DerN : public DerN_minus_1<T> {};
The given hierarchy is simplified and uses multiple inheritance in
real code.
I have to make concrete (non-templated) classes on top of this
hierarchy:
class C1 : public DerN<C1> {};
class C2 : public DerN<C2> {};
....
Now, i have a collector class, that has to register all those C
classes somewhere inside it, like this:
class Collector { private: std::list<SomeType> mylist; };
But, as you know, i can not use templates for SomeType, because
compiler needs a concrete type. But i have to register C classes in a
single collection and C classes have to be on top of the template
inheritance hierarchy.
Could you please advise a solution?
Thank you, Inso Reiges.