Boost logo

Boost :

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 07:30:35


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.

On Wed, Jun 19, 2013 at 1:04 PM, Gonzalo Brito Gadeschi <
g.brito_at_[hidden]> wrote:

>
> I'm not quite sure I'm understanding the question! Does
>> boost::count( filtered_range );
>> not do exactly what you want?
>
>
> boost::count takes a value (just like the STL), there is no version of
> boost::count that simply takes a range.
>
> Also, I don't understand why you'd like am rvalue ref version of count
>> when the argument is const
>
>
> E.g.
>
> boost::cout( range | filter );
>
> would bind to an rvalue.
>


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