Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-08-27 09:06:06


Sounds good! :) I assume you'll add all the other iterator operations such
as decrement, advance, etc.

Cheers,
Jeremy

On Mon, 27 Aug 2001, Toon Knapen wrote:

toon> If others would also be interested I would like to see iterator_adaptors
toon> extended with a strided_iterator_policy.
toon>
toon> Using the strided_iterator_policy, every increment of the iterator will
toon> advance the iterator according a user defined 'stride'
toon>
toon> { // begin example :
toon>
toon> template < int N >
toon> class stride_iterator_policy : public boost::default_iterator_policies
toon> {
toon> public:
toon> template <class BaseType>
toon> static void increment(BaseType& x) { std::advance( x, N ); }
toon> };
toon>
toon> boost::iterator_adaptor< RealValues::const_iterator,
toon> stride_iterator_policy<3> > dof_it( dof_values.begin() );
toon> prod = std::inner_product( shapes.begin(), shapes.end(), dof_it, 0.0 );
toon>
toon> } // end example
toon>
toon> The iterator is here used to traverse the first row of every column in a
toon> column-major matrix.
toon>
toon>
toon>
toon> This type of iterator is frequently used within for instance matrix
toon> operations.
toon>
toon> toon
toon>
toon>
toon> Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
toon>
toon> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
toon>
toon>
toon>

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-9761
----------------------------------------------------------------------


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