The template deduction could be applied to member function?
Why template functions used as member functions could be deducted correctly, whereas it's well known that the class templates could not be deduced.
Here is the related code snippet:
#include<iostream>
class Test
{
public:
template<typename T>
T foo(T in)
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
};
int main()
{
Test tes;
tes.foo(5);
tes.foo(6.0);
}
Aucun commentaire:
Enregistrer un commentaire