Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-10-22 14:17:18


From: "Thomas Wenisch" <twenisch_at_[hidden]>
> Hartmut,
>
> On Tue, 22 Oct 2002, Hartmut Kaiser wrote:
>
> > Peter Dimov wrote:
> >
> > > > After what your code looks like:
> > > >
> > > > nonctl_char = urange_p( '\x21', '\xFF' );
> > >
> > > The question is, would you ever want ['\x21', '\xFF'] to
> > > _not_ be a valid
> > > range?
> >
> > If this is what you want, you could write 'epsilon_p - urange_p( '\x21',
> > '\xFF' )', essentially this means 'match everything (epsilon_p) except
> > ('-') the given range :-)
>
> Perhaps I misread Peter's post, but I understood his question to mean,
> why is the assertion error useful? Why would we want range_p to assert if
> the lower bound > upper bound? (Peter, correct me if I am misinterpreting
> your question).

No, the assertion is probably useful in general since the bounds may have
been computed incorrectly. It's just that in the special case of char being
signed, the purpose of the assertion is mostly to get in the way, as I see
it. '\xFF' is logically greater than '\x21', even if the underlying values
don't say so; range_p('\xFF', '\x21') is probably an error, but the
assertion won't fire.


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