The class std::wstring is missing some operations for "normal" c strings (and literals).
I would like to add these missing operations in my own custom class:
#include <string>
class CustomWString : public std::wstring {
public:
CustomWString(const char*);
const char* c_str(void);
};
The code above compiles fine on Ubuntu Karmic with g++ v4.4.1.
But I am wondering if there are arguments against doing so?
EDIT: some examples to clarify what I mean with "missing operations" :
std::wstring foo("hello"); // requires the L() macro or something like that
std::string bar("hello");
std::wstring goose(bar.c_str());
foo="hello"; // requires the L() macro
foo=bar.c_str();
foo=bar;
EDIT: I would like to have this somehow "centralized". That's because I have a project to be ported from M$-Windows with thousand's of these failing operations.
The nice thing is: there is one central place where the string type to be used is defined, e.g.:
#ifdef WINDOWS_OS
typedef std::wstring AppStringClass;
#else
typedef std::string AppStringClass;
#endif