Boost logo

Boost :

From: metal_at_[hidden]
Date: 2001-08-21 12:27:22


Hello.

On Tue, 21 Aug 2001 09:12:34 -0700
Darin Adler <darin_at_[hidden]> wrote:
 
> You are explicitly creating a char-based regular expression with
> 'boost::reg_expression<char, boost::c_regex_traits<char> >', and it won't
> work for 16-bit characters. You probably need to use
> 'boost::reg_expression<wchar_t, boost::c_regex_traits<wchar_t> >' instead.
> To work with that, your 'results' variable would have to use the type
> 'boost::wcmatch'.
>
> But this guess does not explain why there's no compiler error on the line
> where you declare regex, since I would guess that "aaa" is an 'unsigned
> short [4]', and that shouldn't work to initialize a 'boost::reg_expression<
> char, boost::c_regex_traits<char> >'.
>
> -- Darin

I am sorry. The error message I wrote is wrong.
First I wrote the following code.

 boost::reg_expression<wchar_t, boost::c_regex_traits<wchar_t> > regex(L"aaa");
 boost::wcmatch results;
 boost::regex_match(L"bbb", results, regex); // here the error occurred

Error message is:
error C2665: 'regex_match' : none of the 8 overloads can convert
parameter 1 from type 'unsigned short [4]'

Then I wrote the mail. Before posting it, I wrote simpler code.

 boost::reg_expression<char, boost::c_regex_traits<char> > regex("aaa");
 boost::cmatch results;
 boost::regex_match("bbb", results, regex); // here the error occurred

Error message is:
error C2665: 'regex_match' : none of the 8 overloads can convert
parameter 3 from type 'class boost::reg_expression<char,class
boost::c_regex_traits<char>,class boost::re_detail::jm_def_alloc>'

But I forgot to change the error message and posted it.

takuma


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