Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Range] Filtering elements at even position
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2014-08-10 12:05:39


2014-08-10 17:33 GMT+02:00 Arindam Mukherjee <arindam.mukerjee_at_[hidden]>:

> I am trying to create a range consisting of elements in a container at
> only even indexes. Is there a way to write something like:
>
> vec | boost::adaptors::indexed(0) | some_adaptor_to_choose_even_indexes
>
> I tried with boost::adaptors::filtered, but the index information is
> only present in iterators of the generated range, not in its
> value_type so it is not available in chained adaptors.
>
> - Arindam
>

vec | boost::adaptors::strided(2)

HTH,
Kris



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