Functors in C++
Previous: C++, Lambda expressions in C++
Functors in C++ are classes or structs that overload operator(), allowing
instances to be called like regular functions. Because they are objects, they
can carry state between calls, which is something a plain function cannot do.
Under the hood, lambda expressions are simply compiler-generated functors.