Subject: Re: [boost] [range] Best way to count the elements in a filtered range?
From: Gonzalo Brito Gadeschi (g.brito_at_[hidden])
Date: 2013-06-19 11:13:41
> Try boost::distance(rng | filtered(pred)).
Distance works as expected, thanks!
On Wed, Jun 19, 2013 at 5:03 PM, Nathan Crookston <
> Hi Gonzalo,
> Gonzalo Brito Gadeschi wrote:
> > Someone suggested to use boost::size in the other thread, but size does
> > boost::end(rng) - boost::begin(rng)
> > which is not the number of elements in the filtered range.
> Try boost::distance(rng | filtered(pred)). Size shouldn't even compile,
> since it requires random access, and a filtered range cannot be random
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk