
On 08/12/2011 02:22 AM, Eric Niebler wrote:
I don't think anybody has proposed to implement such a thing. It's a huge amount of work, and it wouldn't be as big a win.
It would definitely be a big win for numerical applications that need to tile loops etc. But then, ranges of ranges work just as well, and are a simpler concept. The runtime perf
gains would be modest, and it doesn't eliminate complexity because there would be no equivalent universal "segmented iterator" in the runtime world. (It would need to store the path-to-the-current-position dynamically, which is a cost nobody would be willing to pay.)
It can be reasonably well implemented using coroutines.
So std::map would still need to implement its own iterators, and at that point you have to ask yourself why you're doing all that extra work.
The segmented iterator of std::map would require using O(log n) memory (for the stack), while the flat one uses a constant amount of memory. O(log n) is still quite reasonable though.