When I say function object, I’m referring to any type with a defined operator().
Actually, that isn't the Standard's formal definition, where a function object is anything that can be called with parentheses. This includes function pointers, classes with overloaded operator(), lambdas (special case of the previous one), and classes that are implicitly convertible to function pointers.
Granted, the latter basically never comes up except in <functional> unit tests.
Most C++ programmers can probably agree that C++11 lambda functions changed their lives.
On the other hand, "lambda function" drives me nuts. Lambdas aren't functions (or std::functions), but such terminology encourages confusion.
Formally, a functor is a mapping between categories that preserves identity morphisms and compositions of morphisms.
No, that's math. Programming is different. Mathematicians consider a "vector" to be different from what we consider it to be.
8
u/SuperV1234https://romeo.training | C++ Mentoring & ConsultingJan 26 '17edited Jan 26 '17
On the other hand, "lambda function" drives me nuts.
38
u/STL MSVC STL Dev Jan 26 '17
Actually, that isn't the Standard's formal definition, where a function object is anything that can be called with parentheses. This includes function pointers, classes with overloaded operator(), lambdas (special case of the previous one), and classes that are implicitly convertible to function pointers.
Granted, the latter basically never comes up except in <functional> unit tests.
On the other hand, "lambda function" drives me nuts. Lambdas aren't functions (or std::functions), but such terminology encourages confusion.
No, that's math. Programming is different. Mathematicians consider a "vector" to be different from what we consider it to be.