Boost Users :
Subject: Re: [Boost-users] regex iterator question
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-03-30 14:25:21
Thanks for all the suggestions.
Actually, this is a one-off program for which I want a correct solution in
the minimal lines of code. So paramount for me is just sticking together
that which is known to work.
Investigating this further, here is what I've found.
The spirit multi-pass iterator is almost ideal. It is a one liner - I like
One can specify a different storage policy - fixed_queue<size_t N> so that
as long as I know that my pattern doesn't exceed a certain size, it will
handle and unbounded file while still keeping a bound on the amount of
storage used. It even will throw an exception if make an error and the
internal buffer overflows. The authors even made a typedef for this version
of multi-pass which they call lookahead<input_iterator, N>. Could this be
more perfect for my application? I don't think so.
But alas, there's a rub. multi-pass hardcodes "forward_iterator_tag" rather
than inheriting the trasversal_tag from it's storage policy - in this case
"random_access_tag". So even though all the code is there and it would work
(I believe) I'm stuck. It's so close, that I'm considering making a tweaked
version of multi-pass to fix this problem. I'm loath to do this as the
implementation is sufficiently general that its a whole learning curve to
understand enough to mess with it with confidence. And of course the time
invested has to be weighed against using a cruder solution.
This is one of the most frustrating things about working with libraries and
computers. The curse of things that "almost work". It's maddening. Note
that I'm not blaming anyone. Its the two-edge sword of importing code.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net