function pointer vs functors in C++
For one, the functor can contain internal state; a state that is valid for this invocation of the function object only. You could add static variables to your function, but those would be used for any invocation of the function. Second, the compiler can inline calls to the functor; it cannot do the same for … Read more