Standard and User-Defined Conversions
3 minute read.
I just came across a surprising bug in my code which I did not expect to cause any problem at all. The simplified code goes like this:
void foo(const std::string& str) { printf("string!"); } void foo(const bool b) { printf("bool!"); } // ... foo("0");
What do you expect? Dumb question …