Why isn't the following valid?
bool trigger(t_evt evt) const {
std::shared_ptr<I> ptr = this->instance.lock();
if (!ptr) {
return false;
}
(ptr->*f)(evt); // -> causes a compilation error
return true;
}
The error in english is something like that (I don't get it in english):
'->*' : improper usage, left operand of type 'std::shared_ptr<ListenerCardsChange>'
f is a pointer to a member function.
Note that (*ptr.*f)(evt);
works fine.