Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-04-05 21:55:19

Allan Odgaard <ML_at_[hidden]> writes:

> On 5. Apr 2004, at 21:22, David Abrahams wrote:
>> 1. There's no way to search a stream for a match because a regex
>> requires bidirectional iterators, so I have to do this totally
>> frustrating line-by-line search. I think Spirit has some kind of
>> iterator that turns an input iterator into something forward by
>> holding a cache of the data starting with the earliest copy of the
>> original iterator. Could something like that be added?
> Added only to the regex library? sounds like it would be a very useful
> general purpose iterator adaptor, as there are also other (non
> standard) algorithms which need to backtrack over the input.

Of course. I just meant, "added for the benefit of the regex

>> 2. Seems to me that if match objects could be converted to bool, we
>> might be able to:
> I can only second that, I am currently using my own regex library
> (some of my reasoning to be found in this c.l.c++.m thread:
> <>), here I also allow implicit conversion to
> the iterator type, which allow code like:
> iterator it = regex:find(first, last, ptrn);
> Although I already did propose it for boost, but was told that it
> poses a problem with the ambiguity of an "empty" match at the end of
> the string and "no match at all" -- my argument here is that if one
> knows that the pattern might generate such a match (and one is
> interested in knowing about it), one just declares the result to be
> the match object. The former generally allows to code w/o all those
> if's to see if something was actually matched -- at least it has made
> much of my code simpler/shorter.

Sounds good to me. John?

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at