Questions tagged [function-templates-overloading]

32 questions
0
votes
0 answers

How overload resolution decides the best between type and substituted type?

I have example that works, but I believe it should not template void foo(int n) { std::cout << "foo(int)" << std::endl; } template void foo(T t) { std::cout << "foo(T)" << std::endl; } int main() { …
Konstantin Vladimirov
  • 6,791
  • 1
  • 27
  • 36
-3
votes
2 answers

Why doesn't function overloading work when default parameters are specified?

When default parameters are not specified, function overloading works. But, why doesn't function overloading work when default parameters are specified? This program takes two integers and compares them to find the larger of the two. Then, it…
1 2
3