我试图清理使用一些代码char*与std::string跑进由下面的代码所示的问题.
void Foo( int xIn , const std::string & fooIn )
{
std::cout << "string argument version called \n";
}
void Foo( int xIn , bool flagIn = true )
{
std::cout << "bool argument version called \n";
}
int main()
{
int x = 1;
Foo( x , "testing" );
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我运行程序时,我得到bool参数版本调用.是一个char*以bool转换优于char*到const std::string&或Visual Studio 2008中捉弄我吗?