std::string provides const char* c_str ( ) const which:
std::string
Get C string equivalent Generates a null-terminated sequence of cha
Get C string equivalent
Generates a null-terminated sequence of cha
Because implicit conversions almost never behave as you expect. They can give surprising results in overload resolution, so it's usually better to provide an explicit conversion as std::string does.