I have a template function for a class C
, and have two other template functions for typename T
, which I would like to use as shown below:
template <typename T>
std::string MyHelperFunction1(...) { ... }
template <typename T>
std::string MyHelperFunction2(...) { ... }
template <class C>
std::string MyFunction(...) {
// if C is an instance of Struct1<T> -> call MyHelperFunction1<Struct1<T>>
// if C is an instance of Struct2<T> -> call MyHelperFunction2<Struct2<T>>
Database db = OpenDatabase();
return MyFunction<C>(db, ...); // The same function but with different input args.
}
The closest question I found was this (How to check for the type of template parameter?), which doesn't work for my case, because I'm calling other template functions inside MyFunction()
. What's a working solution for what I want to have?