среда, 13 мая 2015 г., 5:47:40 UTC+3 пользователь U.Mutlu написал:
The 2nd par should be a bool not a std::string. IMO the compiler should
generate a warning (actually even an error) about it.
...
func(S, "X"); // <-- HERE
It is char *, not a std::string.
From docs:
Boolean conversions
Prvalues of integral, floating-point, unscoped enumeration, pointer, and
pointer-to-member types can be converted to prvalues of type bool.
The value zero (for integral, floating-point, and unscoped enumeration) and
the null pointer and the null pointer-to-member values become false. All
other values become true.