Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-04-17 02:50:41


Hi Doug,

Douglas Gregor wrote:
> Creating new visitors in the BGL can be a pain, because it may require a
> lot of extra typing for simple cases. I'd like to add the ability to
> attach function objects to visitor events like this:
>
> dfs_visitor<>()
> .do_on_back_edge(var(has_cycle) = true)
> .do_on_tree_edge(bind(&vector<edge>::push_back, ref(tree_edges), _1));
>
> I'd really prefer "on_XXX" instead of "do_on_XXX", but GCC trips over the
> former syntax. Anyway, the code is ready to check in if there are no
> objections. The patch isn't very large, but is bigger than I would like to
> post here.

IOW, now specifying behaviour for event requires creating a new class, with
"event_filter" typedef and operator(). You propose to pass lambda,
immediately on dfs_visitor creation. I think this is indeed convenient.
I've some concerns about efficiency, but why don't try?

- Volodya


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