I will explain my question based on following example:
template <typename Param1, typename Param2>
class foo1
{
void lol();
};
template <typename Param1, typename Param2>
class foo2
{
void lol();
};
////////////////////////// FIRST OPTION //////////////////////////
template <typename Param1, typename Param2>
void func(foo1<Param1, Param2> a)
{
a.lol();
a.lol();
}
template <typename Param1, typename Param2>
void func(foo2<Param1, Param2> a)
{
a.lol();
}
////////////////////////// SECOND OPTION //////////////////////////
template <typename Foo_>
void func(Foo_ a)
{
a.lol();
a.lol();
}
///////////////////////////////////////////////////////////////////
int main()
{
return 0;
}
My goal is to write two overloads of func - for foo1 and foo2.
The FIRST OPTION works fine, but I don't like that I have to write template parameters for func that are not used in it.
Is there some way to avoid writing template parameters in signature of func?
I thought of writing something like this SECOND OPTION, but the problem is that overloads do different things.