Consider the class foo
with two constructors defined like this:
class foo
{
public:
foo(const std::string& filename) {std::cout <<
You're passing a char* to the foo constructor. This can be implicitly converted to a boolean (as can all pointers) or to a std::string. From the compiler's point of view, the first conversion is "closer" than the second because it favours standard conversions (i.e. pointer to bool) over user provided conversions (the std::string(char*) constructor).