Sure, the std::string interface is already bloated. But it's missing some (for me) crucial elements. For example, a std::wstring cannot be constructed from a plain const char* (which is what is needed to create one from a string literal). I'd also like to add an operator/ and a split function. Anyways, that's all besides the point of the question. Which is preventing me writing a core class's guts for a project.
I know I can privately inherit from std::(w)string, and "import" all members with using. This misses the crucial non-member template functions, which are numerous.
How can I approach this better? I know public inheritance "solves" the problem, but it introduces the problems of deleteing a base class pointer of a class without a virtual destructor. Note that I'm not planning to add data members, so is this really a problem, or is this corner case still fine to use public inheritance?
Please don't say "don't do this", unless you can provide a way that 1) does what I want, 2) doesn't require me to write it all myself, 3) does not bloat my caller-side interface.
std::wstringshouldn't be used at all; to second order, what's wrong with writing 'std::wstring foo(L"foo")'? Yoursplitandoperator/(what does it even mean to divide strings?!) can perfectly well be free functions, can't they?wstringon Windows andstringeverywhere else, but I want to use standard interfaces, so no specialtcoutandtchar. It's very much possible, there's enough typedefs to hide the underlying type's real name.string(containing UTF-8) everywhere including Windows, converting to "wide"ness only to pass directly to or from Win32 API functions that require it.