class MyDerived: public Incredble<Difficult< And<Complicated, Long>>, And<Even, Longer>, BaseClass, Name>
{
public:
MyDerived();
}
MyDerived::MyDerived
: ???(params)
{}
Is there any way to call a base constructor without writing its full name and without typedeffing it?
The reason is clearly to avoid code duplication and introducing multiple positions to change if a detail in the base class template params changes.
Level 2 of this:
template <uint32 C>
class MyDerived: public Incredble<Difficult< And<Complicated, Long>>, And<Even, Longer>, BaseClass, Name>
{
public:
MyDerived();
}
template <uint32 C>
MyDerived::MyDerived<C>
: ???(C)
{
}
You could use injected-class-name. Incredible<...>::Incredible
refers to itself, and since MyDerived
isn't a class template, unqualified lookup will look in the scope of its base classes:
MyDerived::MyDerived
: Incredble(params)
{}
If Incredible
is a dependent name, then you need to qualify it. You can actually simply use the derived type name to qualify the base class's injected-class-name (h/t Johannes Schaub-litb):
MyDerived::MyDerived
: MyDerived::Incredible(params)
{}
This will work in all cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With