Boost logo

Boost :

From: Nils Springob (nils.springob_at_[hidden])
Date: 2006-10-02 11:28:48


> 1) insert(size_type, uint32_t &). This doesn't compile without using boost.
> It should be written as insert(size_type, utf32_char &)
The bug is fixed.

> 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?
I don't know, but I changed the code to use the BOOST_STATIC_CONSTANT macro,
perhaps this will fix the problem.

> 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.
That's problematic... The size of an encoded string can only be calculated
by iteration. The other problem is, that iterators would be invalid after
assignment, because you can't predict, if reallocation would occur - even
if you reserved some memory before.

> 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.
utf8_string is only a shortcut for unicode_string<utf8_traits>

I added a new file containing some additional encodings, allowing access to
latin1, windows_1252 and cp437 encoded strings.
* unicode_string<latin1_traits>
* unicode_string<windows_1252_traits>
* unicode_string<cp437_traits>

Additionally I updated the existing files, all files can be accessed here:
http://opensource.nicai-systems.com/unicode/unicode.h
http://opensource.nicai-systems.com/unicode/test_unicode.cpp
http://opensource.nicai-systems.com/unicode/encodings.h

Regards,
Nils


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk