Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-04-17 08:29:56


On Thursday 17 April 2003 03:50 am, Vladimir Prus wrote:
> 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?

It's a little worse than just creating the new class with event_filter: you
need to build up a cons-list out of std::pairs containing your visitor types.
I generally just subclass dfs_visitor<>, but that's a typing-heavy hoop to
jump through for a simple visitor.

The efficiency won't be any worse than using a bind object elsewhere in a
program. The do_on_XXX functions merely augment the visitor list of
dfs_visitor and return a new dfs_visitor object.

        Doug


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