Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-10-23 00:57:18


----- Original Message -----
From: "Petr Kocmid" <pkocmid_at_[hidden]>

> > Perhaps ~ch_p('x') and ~digit_p will both result to a chset as well.
> > However, there's a problem. Character sets can support 8/16/32
> > bits. While it is clear that ~ch_p('x') is chset<char> with everything
> > on except 'x', and ~ch_p(L'x') will be chset<wchar_t>, what will be
> > the type of ~digit_p? Shall it be hardcoded to chset<char>?
>
> Perhaps using a chset seems to be a little overkill in certain cases.
>
> I have this idea, resulted from closer look in primitives.hpp: for all single character parsers
which are using locale-style check call in their test function, the most efficient way to make a
complementar parser would be to add a completely new little parser, such as not_digit_p, having
return !impl::isdigit_ in underlying test().
>
> Then ~digit_p could map to not_digit_p and vice versa, making such complement operation naturally
symmetric. And honoring locale, too. More, no need to hardcode anything to chset<char>.

Hmmm. Nice idea. I think this is practical (and fast!)
If there are no objections, I think I like this :-)

Cheers,
--Joel


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