From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2004-02-17 17:01:29
When signalling, with no slots connected, an assertion is raised (if the
return type of the slot is not void). For example:
boost::signal<void ()> sig;
does "nothing" while
boost::signal<int ()> sig;
asserts (if the default combiner is used). I guess that makes sense,
because there can be no "combined" return value if there are no slots.
However, an assertion seems a bit harsh. I am really not sure what
should happen, but maybe an exception is a better alternative, or maybe
an alternative interface can define a default value to be returned if
there are no slots connected), or maybe something else...
Anyway, I guess I was wanting to know why this is the case, and what is
the usual method of handling this circumstance. I assume something
result = sig();
but that just does not look pretty...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk