This post is in reference to the “Visual C++ Team Blog“
Just a short quote as a teaser:
At first glance it does appear that the user is correct – but looks can be deceiving. Just because the string class has a converting-constructor from a string-literal doesn’t mean that the compiler has to use it. For the first argument to the function call, the conversion is straight forward – both of the candidate functions expect a string and so the compiler will use the provided converting constructor to convert the string-literal to an instance of the string class. The second argument is not so straight forward. For the first function the compiler can again use the converting-constructor, but for the second function it can use the standard pointer-to-bool conversion to convert the string-literal (which the compiler will consider as type “const char*”) to bool. As this is a standard conversion, the C++ Standard considers this conversion to be cheaper than calling the converting-constructor (which is a user-defined conversion) and hence the second function is a better match than the first function and the compiler, correctly, calls that function.
No need for me to comment on this. ’nuff said.