Subject: Re: [boost] [spirit] Support for one-pass iterators?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-10-18 22:57:52
Hartmut Kaiser wrote:
> See here (not complete but a starting point): http://tinyurl.com/lk8r43.
> And, FWIW, any further questions will be happily answered on the Spirit
I did some reading and have one observation that I'd like to share
without subscribing to the Spirit list (I have limited time to read this
list already). So sorry if I'm being off-topic.
The docs say that the grammar should pass a reference to the starting
rule to the base class constructor (qi::grammar specialization). But at
this point the rule's constructor has not yet been called. What's more,
the base class calls a method on the passed reference. So, at least, the
docs are not correct when it suggest implementing the grammar that way.
The best way around this is using the base-from-member idiom, which,
IMO, complicates the code quite a bit and is not mentioned in the docs,
as far as I've seen. However, I would suggest to solve this by providing
a way to post-initialize the base class, for example by calling some
init method, like STL streams do.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk