I keep hearing a lot about functors in C++. Can someone give me an overview as to what they are and in what cases they would be useful?
Name "functor" has been traditionaly used in category theory long before C++ appeared on the scene. This has nothing to do with C++ concept of functor. It's better to use name function object instead of what we call "functor" in C++. This is how other programming languages call similar constructs.
Used instead of plain function:
Features:
Cons:
Used instead of function pointer:
Features:
Cons:
Used instead of virtual function:
Features:
Cons: