ofEvent const problem

hello,

i created an event like

ofEvent<bool> timerEnded;

then when i notify the event

 ofNotifyEvent(timerEnded, true);

this is throwing an error.

I found this thread
https://github.com/openframeworks/openFrameworks/issues/1167

i then changed to

 ofEvent<const bool> timerEnded;

but something is going wrong with the listener declaration (which seems expected in the above thread).
This i don’t know how to fix it.

ofAddListener(this->timerEnded, this, &Timer::onTimerEnd);

so for now i am stuck using

bool isTimerEnded = true;
ofNotifyEvent(timerEnded, isTimerEnded);

which is fine for now, but if there is a proper solution, i would find it cleaner.

thanks

the correct signature for the listener would be:

void onTimerEnd(const bool & param);

or

bool onTimerEnd(const bool & param);

where you can mark the event as attended by returning true;

i am already using

void onTimerEnd(bool &val);

you are missing the const

oh i see !
i mistook a line with another
i get it now.

thanks a lot