|
Boost : |
From: John Maddock (john_maddock_at_[hidden])
Date: 2002-07-30 10:06:47
> For one thing, I hope that when 'boost::regex_match' compares iterators
into
> input string and discovers that they are equal, it doesn't spent another 5
> minutes there just hanging around :). Speaking seriously, it's not at all
> clear to me that writing
>
> return input.empty()
> || boost::regex_match(input, match, re, boost::match_default |
> boost::match_partial)
> ;
>
> is going to be faster than plain call to properly implemented
> 'boost::regex_match' (which, after all, can do the same thing inside :)
OK ,
> > The fact that it is NULL tells you that you need some more input
> > before any decision can be taken anyway.
>
> You need explicitly to check for empty string to make that decision. I am
> arguing that this is not a user's responsibility and that this should be a
> default semantics of partial matches. You don't want users that use
> 'regex_match' for input validation to always write
>
> input.empty() || boost::regex_match(... boost::match_partial)
>
> instead of simple
>
> boost::regex_match(... boost::match_partial)
>
> do you?
I can see that point, I think I'm beginning to loose the argument on this
one, I'll at least make it an option (probably the default). I'll let you
know when I get a chance to dig into the code..
John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk