Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2004-06-03 09:57:42


On Thursday 03 June 2004 07:35, Ville Varis wrote:
> 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.

It's been this way "forever", although I think we recently decided that
throwing an exception would be better. We intentionally did not return a
default-constructed value because the returned type might not have a default
constructor. Granted, this case might be sufficiently rare to justify using
your version of last_value.

        Doug


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