Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-15 00:29:11


Roland Richter wrote:

>> 4. Together with filter_view, I'd like to have 'filter' function, so that
>> I can do something like:
>>
>> for_each(
>> filter(vertices(g), boost::lambda::bind(out_degree_f, _1, g) == 0),
>> .....);
>>
>
> Just out of curiosity:
>
> Why don't you use a transform_view instead of for_each()?

Well, I need to invoke a function on each element of filtered sequence, not
transform it further.

> Of course I don't know the details here (i.e. which function
> is meant by "....."),

It's going to be
 
    boost::lambda::bind(add_edge_f, _1, sink, g)

> but wouldn't it be possible here to say
>
> filter_view<Vertices, ...> filtered( vertices(g), bind(...) == 0 );
> transform_view< filter_view<.,.>, ... > result( filtered,
> some_function() );

Do I have to iterate over 'result' to really invoke the function?

- Volodya


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