I have a class based on the code shown here: http://geekswithblogs.net/raccoon_tim/archive/2011/09/28/lambdas-and-events-in-c.aspx
The difference is that I am using variadic templates.
It works well but I can not remove a callback from the vector because I am not able to find it.
Either I am getting an error or I am getting some weird values which I can not compare to find the element.
The code which won't work is:
for (auto i = this->handler.begin(); i != this->handler.end(); i++) {
if ((*i).target<void(Args...)>() == f.target<void(Args...)>()) {
this->handler.erase(i);
break;
}
}
I googled a lot but I was not able to find anything working for this case. For example std::find does not work in my case.
Any help is appreciated.
Silberling
EDIT: As far as I found out is the major problem that std::function does not support == and != for reasons. Is there a way to get around this? Isn't there a method to identify the lambdas so I cam remove it again? I mean, at least it has a location in memory. .target_type() is another approach which I am trying to find out but it thows some "attempting to reference a deleted function"