Function objects provide several advantages over function pointers. The compiler can inline a function object’s overloaded operator()
to improve performance. Also, since they’re objects of classes, function objects can have data members that operator()
can use to perform its task.