
On 02/11/2011 14:09:27 Marsh Ray wrote:
So let me ask the question:
Just when is it really valid to want to jump the 278th "abstract character" in a string?
Seriously, how often do these situations arise?
Well, Boyer-Moore string searching, obviously. And as noted previously, short snippets of null-terminated text are not the only things that people store within a std:string or behind a char *. There's a tremendous amount of data out there in fixed-column databases, for example, and undoubtedly many maintainers who'd like a painless way to upgrade the column unit from 'byte' to 'generic character.' It's also probably a logical fallacy to assume that every string algorithm on every device supported by Boost will always be cache-limited. If strings for you are just handles that you pass to other people's APIs, then no, you don't need random access to the contents. But if you're seriously aiming to create a Unicode-aware drop-in replacement for existing string classes, then it ought to support all of the existing code that assumes efficient random access. And if you can provide measurable speedup for at least the common case, even at the cost of a few extra bits per data chunk, that's worth pursuing.