Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Proposal to add a new range adaptor (first_nd), or modify sliced
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-08-26 22:50:30


> Problem:
> Get the first N element of a SinglePassRange. It is not possible with
> sliced, because it requires RandamAccessRange.

Note that this is possible with the 'taken' range adaptor [1] in the
Boost.Range Extensions library [2] proposed by Akira Takahashi, which
is on the review schedule [3], atlhough with no review date set yet.

The equivalent of sliced(n, m) for SinglePassRanges is also possible
by combining the 'taken' and 'dropped' [4] adaptors from that library:

range | taken(n) | dropped(m)  // same elements as 'range | sliced(n, m)'

Regards,
Nate

[1] http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/range_extension/reference/range_adaptors/taken.html
[2] http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/index.html
[3] http://www.boost.org/community/review_schedule.html
[4] http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/range_extension/reference/range_adaptors/dropped.html
                                               


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net