|
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 https://svn.boost.org/trac/boost?
(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
public:
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))
{
}
to
public:
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)
)
{
}
Regards,
Michel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk