|
Boost Users : |
From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-09-23 12:59:57
miles_gould wrote:
>
> Our application stores all characters internally as XMLCh, which is a
> typedef to either wchar_t or unsigned short, depending on platform and
> various other things. My questions are
>
> 1) Is it even possible to use regex++ with types which are not char or
> wchar_t? The documentation gives no examples of any other types, and
> at one point says "the character type, ie char or wchar_t". When I try
> to construct a reg_expression<XMLCh>, I get the following error message:
>
> ../../src/boost/boost/regex.hpp: In instantiation of
> `boost::regex_traits<unsigned int>':
> ../../src/boost/boost/regex.hpp:461: instantiated from
> `boost::reg_expression<unsigned int, boost::regex_traits<unsigned
> int>, allocator<size_t> >'
> regex.cpp:33: instantiated from here
> ../../src/boost/boost/regex.hpp:461: base class
> `boost::c_regex_traits<unsigned int>' has incomplete type
> ../../src/boost/boost/regex.hpp: In instantiation of
> `boost::reg_expression<unsigned int, boost::regex_traits<unsigned
> int>, allocator<size_t> >':
> regex.cpp:33: instantiated from here
> ../../src/boost/boost/regex.hpp:461: no type named `size_type' in
> `class boost::regex_traits<unsigned int>'
> ../../src/boost/boost/regex.hpp:462: no type named `uchar_type' in
> `class boost::regex_traits<unsigned int>'
> ../../src/boost/boost/regex.hpp:463: no type named `string_type' in
> `class boost::regex_traits<unsigned int>'
> ../../src/boost/boost/regex.hpp:471: no type named `locale_type' in
> `class boost::regex_traits<unsigned int>'
Looks like your XMLCh is actually an unsigned int. AFAIK, there are no
specializations for unsigned int as a char type in the regexp library.
But you should be able to add a specialization for this type, I would
think.
>
> [compilation is on GCC 2.96 under Red Hat Linux 7.2]
>
> 2) Does this mean I need to define a custom traits class? (or rather a
> custom traits class for every possible definition of XMLCh?) Is there
> anything else I need to do?
HTH, Markus
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