Может кто-нибудь сказать, чем отличается компилятор в следующих двух случаях?
#include <cstdio>
using namespace std;
template <typename TReturn, typename T>
TReturn convert(T x)
{
return x;
}
int main()
{
printf("Convert : %d %c\n", convert<int, double>(19.23), convert<char, double>(100));
return 0;
}
И
int convert(double x)
{
return 100;
}
char convert(double x)
{
return 'x';
}
int main()
{
printf("Convert : %d %c\n", convert(19.23), convert(100)); // this doesn't compile
return 0;
}
В первом случае нет перегрузки функций?