Boost logo

Boost :

From: Ville Varis (ville.varis_at_[hidden])
Date: 2004-06-03 07:35:26


Hi,

The next piece of code fails with assertion when calling signals without any connections attached to it.

<code>
#include <boost/signal.hpp>

void test_signaling() {
    ::boost::signal0<int> sig;
/* Next call asserts in boost/last_value.hpp line 29 assert(first != last);
*/
    sig();
}
</code>

This is due to usage of default Combiner boost::last_value<R>. The problem occures when using non-void return values in signals.

I use boost version 1.30.0 but I didn't noticed any changes for this in version 1.31.0.

Quick workaround is to use other Combiner as default, where this problem is removed.

for example
<code>
    ... last_value ....
    T operator()(InputIterator first, InputIterator last) const
    {
      if (first == last)
          return T();
          ...
</code>

best regards,

 Ville Varis
 ville.varis_at_[hidden]

mail.bonum.biz


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