What are the dangers of using an implicit string
conversion operator in a custom string class?
class MyString
{
public:
...
inline operator string() const { return str; }
private:
std::string str;
};
What are the dangers of using an implicit string
conversion operator in a custom string class?
class MyString
{
public:
...
inline operator string() const { return str; }
private:
std::string str;
};
The main "danger" of implicit conversion is mostly: You might get an unexpected conversion.
If your string class can logically be used as a std::string, I do not think there is a problem.