Ignore:
Timestamp:
Jul 22, 2008, 10:18:51 PM (13 years ago)
Author:
Peter
Message:

fixes #402 - constness conversion in StrideIterator?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/StrideIterator.h

    r1378 r1386  
    2828#include "iterator_traits.h"
    2929#include "yat_assert.h"
     30
     31#include <boost/iterator/iterator_adaptor.hpp>
    3032
    3133#include <iterator>
     
    126128   
    127129    /**
    128        Conversion from mutable iterator to const iterator. Only works
    129        if underlying iterator is a pointer.
    130      */
    131     // Peter, this is ugly hack to provide iterator to const_iterator
    132     // for our gsl_iterators - solution? use Boost:iterator_adaptor
    133     operator StrideIterator<const value_type*>()
    134     { return StrideIterator<const value_type*>(base(), stride_); }
     130       \brief Conversion constructor.
     131
     132       Create a StrideIterator<Iter> from a StrideIterator<I2>. Possible
     133       if I2 is convertible to a Iter. Constructor allows implicit
     134       conversions such as iterator to const_iterator.
     135     */
     136    template<typename I2>
     137    StrideIterator(StrideIterator<I2> other,
     138                   typename boost::enable_if_convertible<I2, Iter>::type* = 0 )
     139      : iterator_(other.base()), stride_(other.stride()) {}
    135140
    136141    /**
Note: See TracChangeset for help on using the changeset viewer.