This is what I want to achieve. The leaf component will inherit Component<ParentT>, others will inherit Component<ParentT, ChildT>
template <typename T>
class Component{
protected:
typedef Component<T> ParentComponentT;
...
};
template <typename ParentT, typename ChildT>
class Component: public Component<ParentT>{
protected:
typedef std::vector<ChildT*> CollectionT;
...
};
But the problem is Template parameters getting redeclared. and I cannot move the second one above first one because second one inherits first one.
error: redeclared with 2 template parameter(s)
note: previous declaration ‘template class Component’ used 1 template parameter(s)