Boost logo

Boost :

Subject: Re: [boost] [range][stride] broken?
From: Michel MORIN (mimomorin_at_[hidden])
Date: 2010-12-22 04:48:21

Hi Maxim,

Maxim Yanchenko wrote:
> Am I doing anything wrong, or range::stride is broken?

I think it's a bug of strided_range.
Could you please create a ticket for this at
(It would be better to provide a minimal test case.)

Quick hack to fix this is changing the strided_range's constructor

// boost/range/adaptor/strided.hpp Line 89
    template< typename Difference >
    strided_range(Difference stride, Rng& rng)
        : super_t(make_strided_iterator(boost::begin(rng), stride),
            make_strided_iterator(boost::end(rng), stride))


    template< typename Difference >
    strided_range(Difference stride, Rng& rng)
      : super_t(
        make_strided_iterator(boost::begin(rng), stride)
      , make_strided_iterator(boost::begin(rng) + (boost::size(rng) +
stride - 1) / stride * stride, stride)


Boost list run by bdawes at, gregod at, cpdaniel at, john at