参数或返回类型隐式转换在C++中是否优先?

Nic*_*ite 2 c++ implicit

如果我有代码:

int f(int a) { return a; }
double f(double g) { return g; }

int main()
{
    int which = f(1.0f);
}
Run Code Online (Sandbox Code Playgroud)

调用f的哪个重载,为什么?

Mar*_*som 8

返回类型根本不考虑过载,因此您将获得双重版本.