Is it possible to add some condition to boost::signal
. It may get some Boolean function and when I emit signal it should check if function returns true then emit.
I don't want to check the condition during emitting because it is emitted it many places. I also don't want to check the condition in the slot because it should not know about that condition.
If you need to emit signal from many places this way, I would add a method for it:
void emitSignal()
{
if( /* condition */ ) {
_signal();
}
}
then you call emitSignal()
instead of emitting signal directly.