I've read a number of similar questions here but I'm still uncertain of the answer. I understand that deriving from STL classes is discouraged but std::basic_string seems like a good candidate.
The problem I face is that g++ is throwing a fit because std::basic_string does not have a virtual destructor. Why isn't it virtual? Doesn't std::string derive from it?
One attempt:
class string_t :
private std::basic_string<char>
{
public:
string_t() :
basic_string<value_type>() {}
string_t(
const basic_string<value_type>& s) :
basic_string<value_type>(s) {}
virtual ~string_t() {}
};
Another attempt:
class string_t :
public std::basic_string<char>
{
public:
virtual ~string_t();
};
Both throw this warning when compiling with -Weffc++:
warning: base class 'class std::basic_string' has a non-virtual destructor