Re: [xpressive] Using it with input iterators or how far the backtracing will go back
Joel de Guzman <[email protected]> Tue, 09 Nov 2010 10:15:06 +0800
| Newsgroups | gmane.comp.lib.boost.user,gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/9/2010 3:03 AM, Eric Niebler wrote: > (cross-posting to spirit-devel) > > On 11/8/2010 12:36 PM, Alex Dubov wrote: >> Nat Linden<nat<at> lindenlab.com> writes: >>> Once upon a time, the Serialization library came with backtracking input >>> iterators used to parse XML input files with Spirit. I briefly glanced over >>> more recent Serialization documentation without spotting them. Do they still >>> exist? >> >> Yes, in a way. >> Spirit only requires forward iterators, not bidi ones, like xpressive. Input >> iterators can be adapted to become forward ones in a fairly straightforward >> way, and indeed, spirit has a customizable multi_pass iterator adapter to do >> just that. >> >> Up until now I thought spirit to be an overkill for my stuff, but I'm >> considering using it now. > > Just hazarding a guess here, but the multi_pass_iterator probably works > by caching all the read data so far. Otherwise, how would it support > making a copy of the begin iterator and dereferencing it at a later > point in time? If that solution wasn't good enough for you before, you > probably don't want multi_pass_iterator+Spirit. > > Can the Spirit guys chime in on this? The multi_pass iterator uses a sliding window that can be flushed when you reach a deterministic point, a point of no return where back-tracking is no longer an option. In this case, saved iterators are invalidated. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net