
On Tue, Apr 06, 2004 at 05:51:07PM -0400, David Abrahams wrote:
Pavol Droba <droba@topmail.sk> writes:
On Tue, Apr 06, 2004 at 02:43:20PM -0400, David Abrahams wrote:
[snip]
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?
Not really as far as I know. Iterators are bound to the collection that is being searched, not to the match itself. Therfore, they validity should not be bound the lifetime of them match. They will be copied to the iterarator_range.
The match object *is* the collection (of submatches) being searched.
But what is a submatch? From the definition it is a pair of iterators. Those iterators are for sure not pointing into the submatch itself, rather to the container that was searched. Unless I'm mistaken, but then it would have no sense. It the example above, the iterator_range will contain the pair of iterators from the top level submatch. Pavol