Suppose I have a method that simplifies up to this
template<typename t,typename u>
std::shared_ptr<bar> MyClass::getFunct(std::string SomeStr)
{
.....
std::map<std::string,std::shared_ptr<foo> > j;
....
std::shared_ptr<u> collection(new u());
for (auto val : j){
val.second->getMethodA()
}
}
Now i use it as
getFunct<FirstType>("SomeString")
getFunct<SecondType>("SomeString")
getFunct<ThirdType>("SomeString")
Now val.secondin line A has 3 methods in it
val.second->getMethodA()
val.second->getMethodB()
val.second->getMethodC()
I am currently using
val.second->getMethodA()with a template typeFirstType
In any case, I need to specify the use getMethodBif the type of the template SecondType
and use getMethodCif the type of the templateThirdType
source
share