Imagine I have a big list of typedefs that I don't want to repeat for all classes, and I create a base class:
template<class Derived>
class TypesDefs
{
using ptr = std::shared_ptr<Derived>;
//... many of them
};
Then I implement some concrete classes:
class A : public TypesDefs<A>
{
};
My problem, as expected, is when I do:
class C: public TypesDefs<C>, public A
{
};
The C::ptr becomes ambiguous as it could be TypesDefs<A>::ptr or TypesDefs<C>::ptr.
Any idea how I can define the types following the same/working above logic, please?
I tried some tricks with std::enable_if to always inherit the first time if the class is not derived already from TypeDefs, but got some compiling issues. I also tried virtual inheritance, but no luck.