Going whole interfaces for a single functor is a bit of overkill and often the sign of Javaisms creeping into C++ (not trying to whack on Java here, but the two languages require a very different mindset).
There is a reason C++ finally got a proper std::function and lambdas and that is because there are many cases where a full-blown interface just is not the right choice.
Edit: there is also the issue of a true interface always introducing runtime polymorphism (again something that is not an issue with a JITed Java but a potential issue in C++ where runtime polymorphism is often not needed and compile time polymorphism would be enough). But that is just going off on a tangent here...
A problem about a pointer to member function?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement