
On Mon, Oct 31, 2011 at 12:31 PM, Nathan Ridge <zeratul976@hotmail.com>wrote:
Is there interest in adding a Top-Bounded adaptor into Boost.Range ?
Example:
using namespace boost::adaptors; using namespace boost::assign;
std::vector<int> input; input += 1,2,3,4,5,6,7,8,9;
boost::copy( input | bounded(0), std::ostream_iterator<int>(std::cout, ",")); // prints nothing boost::copy( input | bounded(1), std::ostream_iterator<int>(std::cout, ",")); // prints 1, boost::copy( input | bounded(2), std::ostream_iterator<int>(std::cout, ",")); // prints 1,2, boost::copy( input | bounded(8), std::ostream_iterator<int>(std::cout, ",")); // prints 1,2,3,4,5,7,8,
There is a Boost.Range extension library called P-stade Oven which provides this adaptor under the name "taken", and many other adaptors:
http://p-stade.sourceforge.net/oven/doc/html/index.html
There exists an effort to port the P-stade Oven library to Boost, called OvenToBoost: https://github.com/faithandbrave/OvenToBoost. If you are interested in seeing functionality like this in Boost, perhaps you can consider contributing to this effort.
"taken" is what I was looking for. I will contact the project owners to offer my help. Thanks!! Regards, Fernando.