
Nils Springob wrote:
However it isn't basic_string and it means it is isolated from the rest of standard library. In perfect world I would expect to read/write utf_strings from std::streams in the same way it is provided for std::string i.e. all the operations like operator>>, getline and so on should be usable on utf_strings. It is always possible to access the basic_string<> data by calling raw()! The standard requires character access, which can't be implemented efficiently for utf8 and utf16 encoded strings.
I see! I have some tips to your code: 1) insert(size_type, uint32_t &). This doesn't compile without using boost. It should be written as insert(size_type, utf32_char &) 2) I have also other compiler problem on line static const size_type npos = string_type::npos; With my msvc8 I Am getting error C2057: expected constant expression. I don't understand because string_type::npos IS constant expression. Do you know what's the problem here? 3) In append, assign and ctor members you should call raw_string.reserve before appending characters to be more effective. I know that sometimes the exact number of characters (code units) isn't known but it's better to reserve at least the minimal count. 4) This is rather cosmetic. I think something like ustring<windows_1252> would be both more tabular and more boost-way than current windows_1252_string. You can do it easily by uniting all your utf*_traits classes into one template and specializing on predefined struct tags. Regards Tomas