Boost logo

Boost :

Subject: Re: [boost] [range][stride] broken?
From: Maxim Yanchenko (maximyanchenko_at_[hidden])
Date: 2010-12-22 08:08:14


Neil Groves <neil <at> grovescomputing.com> writes:
>
> On Wed, Dec 22, 2010 at 11:20 AM, Maxim Yanchenko
> > Michel MORIN <mimomorin <at> ...> writes:
> > > Maxim Yanchenko wrote:
> > > > Am I doing anything wrong, or range::stride is broken?
> > > I think it's a bug of strided_range.
> > Thanks for confirmation, created a ticket:
> > https://svn.boost.org/trac/boost/ticket/5014
> I wanted to apologize for this mistake. I can assure you that I am working
> on this right now. I will submit a fix to boost-trunk today. After a couple
> of days of passes on boost-trunk I shall merge to boost-release.

Thanks, Neil, great news.

Just in case - why stride works for Random Access Sequences only?
Why can't I use it for Input sequence like istream_range (e.g. "process every
10th word")?
I hope it's already in your Todo list.

Also, I don't see any easy way to skip x first elements. "slice" doesn't help as
I need to know size that I might not know in advance, for example, in this setup:
v | filtered(by) | sliced(5,???)

And similar question about skipping n elements at the end of the sequence.
Basically, it would be great to have Python-style slice, as it's concise and
easy to use, like here:
>>> a=[1,2,3,4,5,6,7,8,9,10]
>>> a[3:-3]
[4, 5, 6, 7]

Thanks,
Maxim


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