
It seems that basic_slice iterators are indexed, they store an integral index and dereference looks like: return (*this) ().start () + it_* (*this) ().stride (); This seems to kill performance. Is there any good reason why slice iterators could not be based on pointers? If it were, the most common use, which would iterate using 'it++' should be faster.

on Sun Oct 19 2008, Neal Becker <ndbecker2-AT-gmail.com> wrote:
It seems that basic_slice iterators are indexed, they store an integral index and dereference looks like: return (*this) ().start () + it_* (*this) ().stride ();
This seems to kill performance. Is there any good reason why slice iterators could not be based on pointers? If it were, the most common use, which would iterate using it++' should be faster.
Usually you have to do something like that to avoid forming invalid pointer values during iteration. Think about what happens when the underlying array size is not an even multiple of the stride length. -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (2)
-
David Abrahams
-
Neal Becker