I have a class like this:
template<class T> class A : public T {
// this is done to wrap the base class version of a virtual function
virtual void F(int i) {
if(i < 0) T::F(-i);
else T::F(i);
}
//...
that needs to be constructible for any set of args the base class can be constructed with:
template <typename T1> A(T1 t1) : T(t1) {}
template <typename T1, typename T2> A(T1 t1, T2 t2) : T(t1, t2) {}
// ho, hum, copy, paste, yuck.
// ....
All's good but for the default constructor:
template <> A() : T() {}
doesn't compile
A() : T() {}
fails if T has no default constructor even if A() isn't called.
}
Is there a way to make A()
a template without any args?