|
Boost : |
Subject: Re: [boost] [regex] How robust are the <boost/regex/pending/unicode_iterator.hpp> adapters?
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-07-23 11:07:54
on Tue Jul 19 2011, John Maddock <boost.regex-AT-virgin.net> wrote:
> Actually, I'm thinking that the fix may be easier than I thought after
> all -
> if I add a 2-arg "range-checked" constructor as an overload, then the
> iterator's constructor can validate the end-points of the underlying
> sequence during construction,
Doesn't that make construction of an iterator over N bytes an O(N)
operation?
> and there's no need to otherwise change the implementation or add
> overhead by checking every increment/decrement for movement
> out-of-range because we'll know that it can't happen.
To be preciseâI thinkâit can't happen unless the bytes in the underlying
buffer are changed after construction. It's not *quite* the same
guarantee, but it's probably good enough, and maybe even preferable.
I would suggest that anyone needing the other kind of check adapt an
underlying iterator that contains the check.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk