I read C++ coding standards (Herb Sutter and Andrei Alexandrescu) and two articles below.
Intuitively, a function object has additional overhead compared to a function, because it is an object in C++. However, it seems that function object invocation usually outperforms function calling. I know that inlining is one of the optimizations function object provides.
So my questions are:
Why are function objects so fast? Is it all because of inlining?
How does the function object get implemented? Is it translated into ordinary function call at compile time? Or are there any difference in runtime logic?
Are there any cases in which function objects are slower than functions?
Detailed difference between functor's call and function call?