I'm a bit confused about templated member functions, let's suppose that we have some weird struct with a templated member function, like this:
struct Foo
{
template <typename T> void f(T t) {};
};
And then, we store that struct into some standard container:
std::vector<Foo> V;
V.push_back(Foo());
V.push_back(Foo());
V.push_back(Foo());
V.push_back(Foo());
Next; let's call different instances of the templated member function:
V.at(0).f<int>(1);
V.at(0).f<char>(2);
V.at(1).f<float>(3.4f);
V.at(2).f<double>(5.6);
V.at(3).f<long>(7);
And finally, the questions:
¿All the instances of Foo class are from the same class? it seems that the answer is yes but... the first Foo instance has at the end two overloads of the f member function:
[0] Foo::f(int t);
[0] Foo::f(char t);
And in the other hand, the other Foo instances seems to have only one version of the f function. So apparently the base type of each instance is different due the differences on member functions.
[1] Foo::f(float t);
[2] Foo::f(double t);
[3] Foo::f(long t);
¿Where the f functions are instanced? apparently we can get the address of the Foo::f(int t) function only from first Foo instance, because that function only belongs to that instance; same for the other functions.
Thanks in advance.