Advantages of Function Objects Over Function Pointers

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.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.