Functions and Function Objects
Explore the differences and uses of functions and function objects in C++. Understand how function objects can hold state and be instantiated, and discover predefined function objects in the standard library to customize behavior in your code.
We'll cover the following...
We'll cover the following...
Functions
Functions are the simplest callables. They can have - apart from static variables - no state. Because the definition of a function is often widely separated from its use or even in a different translation unit, the compiler has fewer opportunities to optimize the resulting code.
Function Objects
At first, don’t call them functors. That’s a well-defined term from the category theory.
Function objects are objects that ...