Is it possible to implement such behaviour? It does not have to use inheritance, I just want to implement template method design pattern with generic arguments passing (with c++ templates).
class A {
public:
template<typename ...tArgs>
void call(tArgs ...vArgs) {
for (int i = 0; i < 5; ++i)
impl(vArgs...);
}
};
class B : public A {
public:
void impl() {}
void impl(int) {}
};
int main() {
B b;
b.call(); // ok
b.call(1); // ok
b.call(""); // compile error, no method to call inside 'call'
return 0;
}