This is a terse but detailed description of function objects in C++ (any object for which the function call operator operator()
is defined), including the different ways to pass them to functions and how each are implemented under the hood.
The three main types of function objects are lambdas (anonymous function objects), std::function
, and C-style function pointers.
Exactly what they sound like: just a pointer to the address of a function. Note that &foo
and foo
are equivalent.
Lambdas are NOT std::function
s.