나는 다음과 같은 코드가 있습니다암시 적 캐스트에서 bool하는
bool
은 내가 출력으로 예상 한 것 : :이 출력을 얻을 때 실행
#include <iostream>
#include <string>
void foo(bool a)
{
std::cout << "bool" << std::endl;
}
void foo(long long int a)
{
std::cout << "long long int" << std::endl;
}
void foo(const std::string& a)
{
std::cout << "string" << std::endl;
}
int main(int argc, char* args[])
{
foo("1");
return 0;
}
을
string
g ++ 4.9가 왜이 문자열을 암시 적으로 bool로 변환합니까?