Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-03-09 07:52:12


> Hello, I use freebsd 4.11 & gcc3.3.6 and gcc 3.4.4
> with both I don't have std::wstring defined. I only need it fo some
> internal use. So, I defined:
> typedef unsigned short uchar16
> typedef basic_string<uchar16> string16;
> and it was enough for me (I don't do iostreams with this string)
> But, I need regex support for this. As I read in a few mail boost does not
> create wregex on some platforms with limited support for wchar_t, so I
> tried to create one the same as I did with string:
> typedef reg_expression<uchar16, regex_traits<uchar16>,
> BOOST_DEFAULT_ALLOCATOR(uchar16)> regex16;
> When I try to use regex16 I get a big load of errors. Did I missed
> something?

Yes, the regex library needs a traits class that instructs it how to
interact with the locale for that character type. In theory you could just
use cpp_regex_traits<uchar16>, but that would require that all the
std::locale facets are supported for uchar16 (I'm sure that they are not).

If you're prepared to depend upon ICU, then the current cvs has (optional)
support for 16 and 32-bit Unicode character types, the traits class design
is also rather simplified and better documented, so that would be the best
bet if you wanted to define your own minimalist traits class for uchar16 as
well.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net