3 ms·
If you start with void foo(std::string x, int y); void foo(const char* x); Then calls to foo("bar", 0) would resolve to the first overload: the second
by quietbritishjim 3y ago
If you start with
void foo(std::string x, int y);
void foo(const char* x);
Then calls to foo("bar", 0) would resolve to the first overload: the second isn't a match at all, but the first is a match with an implicit conversion from const char* to std::string. But if you removed the second parameter, including arguments at all call sites, then foo("bar") would match the second better because it doesn't involve any conversions, so it would be selected instead of the first.