Boost logo

Boost :

Subject: Re: [boost] [ublas] slice iterators are indexed iterators
From: David Abrahams (dave_at_[hidden])
Date: 2008-10-21 14:00:12


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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk