Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-02-23 17:06:45


Frank Mori Hess wrote:

> However, my way also allows track() to be called an arbitrary number of
> times before connecting the slot. How would multiple tracked objects be
> handled with a track(p).connect()/.connect_to() syntax? If you allow
> track to take varying numbers of arguments, it requires the user to know
> how many tracked objects there will be at compile time. Being able to
> call track() multiple times only requires knowing the number of tracked
> objects at run time, which might be handy if the tracked objects are being
> collected in a container.

This is a good argument for the slot-based alternative.

slot_type slot( f, ... );

for_each( tracked.begin(), tracked.end(), bind( &slot_type::track, _1 ) );

signal.connect( slot ); // or slot.connect_to( signal );

> I suppose you could overload track to accept a container argument.

This would work well with the

signal.connect( bind( f, ... ), tracked );

syntax, but we're losing the ability to drop the bind. :-)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net