code below ?
template<typename T>
class CDerived : public CBase<T>
{
public:
CDerived() : CBase() {}// error
}
You probably need to specify the type CBase<T>()
It is derived from CBase<T> and CBase<T>::CBase() is not templated.
Yes, but as far as I remember any time you refer to the base class, you need to specify the full type because CBase is still a templated class. Or you can make an alias inside your class using Base = CBase<T>; and use this Base as the type of the base class. https://ideone.com/BIpAjR
Do you know the article on standart ?
No, I don't know any good links about this unfortunately.
nevertheless @gameraccoon is right on this topic you have to _fully_ specify the class
Did you try CBase<T>::CBase() ?
Why ? What is the purpose of ex: template<typename T> class CDerived : public CBase<T> { public: CDerived() : CBase<int>() {} }
The constructor would be CBase<T>, you are inheriting a templated class
Why the fuck did you put int in there oO
typical example could be found in the boost libraries, where you inject certain behaviour into your class like this
like obtaining a shared reference to itself
Wow. Answer to silence ?
For example if you for some reason using multiple inheritance of many CBase specializations the compiler wouldn't be able to guess what you mean.
can you show which ?
nah constructor doesnt like any other method.
Check any TCP server implementation using boost::asio
Not sure what you mean. You proposing a way of calling a constructor that wouldn't make sense in some situations.
you mean supplying argument to template parameter wouldnt make sense ?
I gave you an example when the compiler wouldn't be able to decide what constructor you want to call in this case. I'm pretty sure it's not why it's not implemented, and even not sure if it's never going to be implemented this way in future (we already have CTAD, this is not so far from it).
Have you done it before ? the multiple inheritance of many CBase specialization ? The reason why we have to supply template argument to call base ctor ?
Not sure, maybe, I've edited a lot of strange code including some weird template monsters. I agree that's not a common case, but these cases also need to be accounted.
Обсуждают сегодня