I was trying to clean up some code that uses char*
with std::string
and ran into a problem that is illustrated by the following code.
One simple fix would be to change the bool
to int
- there is an implicit conversion from a pointer to bool
, but not to int
. bool
to int
is not a problem, so the existing code that passes bools will continue to work.
Unfortunately this does impact the code readability a little by masking the parameter's intent.