
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