Since std::string is actually a typedef of a templated class, how can I override it? I want to make a UTF-8 std::string that will return the correct length, among other things.
std::string
typedef
If you must define your own string type, then don't inherit from std::string but define your own Character Traits class and do something like
typedef std::basic_string<unsigned char, utf8_traits> utf8string;
See also Herb Sutter's website.
2.1m questions
2.1m answers
60 comments
57.0k users