habe endlich mal wieder Zeit etwas privat zu proggen, und will bei den Strings weitermachen. Momentan benutze ich typedef's von std::basic_string:
Code: Alles auswählen
typedef std::basic_string<QxNativeChar, std::char_traits<QxNativeChar>, std::allocator<QxNativeChar> > QxNativeString;
typedef std::basic_string<QxUtf8, std::char_traits<QxUtf8>, std::allocator<QxUtf8> > QxUtf8String;
typedef std::basic_string<QxUtf16, std::char_traits<QxUtf16>, std::allocator<QxUtf16> > QxUtf16String;
typedef std::basic_string<QxUtf32, std::char_traits<QxUtf32>, std::allocator<QxUtf32> > QxUtf32String;
Nun habe ich mehrfach gelesen, dass man von std::basic_string nicht ableiten soll. Also suche ich nun nach Alternativen, und wollte mal hören für welche Alternative Ihr Euch eintscheiden würdet. Spontan fallen mir folgende Ansätze eine:
(1) Hilfsklassen mit statischen Methoden schreiben. Zum Beipsiel
Code: Alles auswählen
String StringUtils::AppendPathComponent(const String & rPath, const String & rPathComponent);
Code: Alles auswählen
class QxUtf8String
{
...
private:
std::basic_string<QxUtf8, std::char_traits<QxUtf8>, std::allocator<QxUtf8>> m_string;
};
(4) Was auch immer Euch und mir noch so einfällt.
Freue mich auf Eure Meinungen.