
25 Jul
2011
25 Jul
'11
11:43 a.m.
On 23/07/2011 19:44, John Maddock 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?
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?