|
Boost : |
Subject: Re: [boost] [regex] How robust are the<boost/regex/pending/unicode_iterator.hpp> adapters?
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-07-25 11:08:16
>>>> 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?
>>
>> No, it only checks that each *end* of the sequence contains a valid
>> multibyte sequence - effectly these can then act as sentinels - if there
>> are invalid sequences within the range (not at the endpoints) then we
>> can catch these anyway already.
>
> That requires the underlying iterator to be bidirectional, right?
Correct - but that's what regex requires anyway (which is all these are used
for for now).
I guess a more sophisticated version could adapt to the traversal category
of the underlying iterator - using relatively lightweight endpoint checking
when it's possible and "check every increment" for forward/input iterators?
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk