Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-04-06 13:43:20


Pavol Droba <droba_at_[hidden]> writes:

> On Tue, Apr 06, 2004 at 11:59:00AM +0100, John Maddock wrote:
> Hi,
>
>> So we make match_results implicitly convertible to it's iterator type? I'm
>> not necessarily against that, but there are dangers: mainly as Alan stated
>> that you can easily miss corner cases (when the regex matches a zero-length
>> string).
>
> I just want to add 0.02p.
>
> Maybe it would be good, to make regex match_results convertible to the iterator_range
> defined in the string algo library. iterator_range is used as a result of find
> operations, it is convertible to safe-bool and its purpose is to delimit a part of a collection.
>
> It was requested during the review of the string algo library, that this facility
> should be extracted and documented as a general purpose utility. It can be standardized
> then as a generic result of find operation.
>
> What would be the advantage? User can write
>
> iterator_range res=regex_maxch(...);

Doesn't the match object get destroyed here, thereby invalidating the
iterators?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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