Boost logo

Boost Users :

From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2004-08-02 00:48:38


Am Montag, 2. August 2004 01:25 schrieb Doug Gregor:

> > - I call sig(); and the first slot connects a new slot to signal which
> > has a
> > higher priority (group -> higher values are executed at first)
>
> According to the docs,

docs : http://www.boost.org/doc/html/signals.html ?

> it's unspecified whether or not this slot will
> be called.

Because I need only the topmost slot called, I could add a combiner which
dereferences only one time and loop over signal - could result in side
effects?!

struct call_topmost
{
    typedef void result_type;
    
    template<typename InputIterator>
    result_type operator()(InputIterator first, InputIterator last) const
    {
        if ( first != last) * first;
    }
};

...
boost::signal< void(), call top_most > sig;
....
while ( ! sig.empty() ) sig(); // each called slot will be disconnected
...

with best regards,
Oliver

-- 
"Der Spezialist ist ein Barbar, dessen Unwissenheit nicht allumfassend ist."
Master's Voice, S.LEM

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