Boost logo

Boost :

From: John Maddock (boost.regex_at_[hidden])
Date: 2003-09-02 05:22:55


> Also I see the existence of boost::regbase::use_except and
> boost::regbase::failbit
> I don't see how to use them in a way to enable/disable exceptions in
> regular
> expressions, dispite probably the activation of the general
> BOOST_NO_EXCEPTIONS
> (Shame on me!).
>
> Question: It seems, that boost::regbase::use_except is always active,
> because it
> is or'ed to the flags arguments in every(?) c'tor or assignment of
> reg_expression.
> Is that true?

Yes.

> If that is true: Why does the flag regbase::use_except (officially)
> exist?

It's a historical accident and should have been removed from the docs.

> Lets assume, that throwing boost::bad_expression is a general policy (I
> can live with that),
> it would be **very** nice to have at least one (probably static) member
> function,
> which takes a textual regular expression and an optional bunch of
> regbase flags as arguments and
> returns a bool, which simply returns true in case of a valid expression,
> otherwise false. What
> do you think of that?

You could call the undocumented member function set_expression which would
return 0 on success, alternatively you're back to rolling your own, BTW why
do you want this? If a regular expression is valid, then presumably at some
point you would want to use it? I ask because the job of checking the
expression for validity is essentially the same as compiling it to a state
machine.

John


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