ambiguous call to overloaded function
问题 I have two functions: void DoSomething( const tchar* apsValue ) void DoSomething( size_t aiValue ) Now I want to pass '0' as a size_t: DoSomething(0); The compiler throws an error: "ambiguous call to overloaded function" To solve this, I can use static_cast, for instance: DoSomething(static_cast<size_t>(0)); Or simple: DoSomething(size_t(0)); Is one of them better than the other? Are there any other approaches to solve this? 回答1: It's ambiguous because 0 has type int , not size_t . It can