Showing only posts by Jonathan Hale. Show all posts.

Standard and User-Defined Conversions

~ 3 minute read.

I just came across a sur­pris­ing bug in my code which I did not ex­pect to cause any prob­lem at all. The sim­pli­fied code goes like this:

void foo(const std::string& str) { printf("string!"); }

          void foo(const bool b) { printf("bool!"); }

          // ...

          foo("0 …
« newer articles | page 5 | older articles »