6 ms·
Functor is one of the worst offenders IMO. In C++ lingo, it simply means "callable object".
by codeflo 2y ago
Functor is one of the worst offenders IMO. In C++ lingo, it simply means "callable object".
- halayli 2y agoIn C++ lingo they are called function objects or callables, not functor. You might stumble on code here and there that suffix a class name with Functor but it's not that common.
- codeflo 2y agoMany blog posts and Stackoverflow questions about C++ cal them functors. Boost of all things uses the term in its definitions: https://www.boost.org/doc/libs/1_60_0/doc/html/function/reference.html#header.boost.function_hpp https://www.boost.org/doc/libs/1_60_0/doc/html/function/refe... It's common enough that articles have been written against this usage: https://web.archive.org/web/20170224220253/http://jackieokay.com/2017/01/26/functors.html https://web.archive.org/web/20170224220253/http://jackieokay... So this usage of functor may never have been "official", but it's widespread in the community.
- plorkyeran 2y agoI would say it was widespread, but it's now fallen out of favor. Alexandrescu got the name wrong 25 years ago† and that got embedded into early boost, but by the time that blog post was written I feel like I'd mostly stopped seeing it being used by C++ experts. † I don't know if the original mistake was his, but he certainly did a lot to spread it.
- Maxatar 2y agocppreference.com uses the term functor in numerous places for recent C++ features including things in C++26 such as reflection: https://en.cppreference.com/w/cpp/experimental/reflect https://en.cppreference.com/w/cpp/experimental/reflect https://en.cppreference.com/w/cpp/utility/variant/visit2 https://en.cppreference.com/w/cpp/utility/variant/visit2 https://en.cppreference.com/w/cpp/experimental/parallelism https://en.cppreference.com/w/cpp/experimental/parallelism Visual Studio's official documentation uses the term functor as of 2021: https://learn.microsoft.com/en-us/cpp/standard-library/function-objects-in-the-stl?view=msvc-170 https://learn.microsoft.com/en-us/cpp/standard-library/funct... A simple Google search shows no shortage of recent websites and documents including fairly authoritative references using the term functor to describe a type that overloads operator (). Heck even the author of this article, Raymond Chen, uses the term functor as recently as 2020 to describe such a construct: https://devblogs.microsoft.com/oldnewthing/20200513-00/?p=103745 https://devblogs.microsoft.com/oldnewthing/20200513-00/?p=10... Is Raymond Chen not a C++ expert?
- sgbeal 2y ago> In C++ lingo they are called function objects or callables, not functor. The word "functor" has a long and glorious history in C++. Try entering "C++ Andrei Alexandrescu functors" into your internet search engine of choice. For bonus points, try "c++ Scott Meyers functor" as well.
- Maxatar 2y agoThe creator of C++ uses the term functor in the book "The C++ Programming Language" to describe any object that overloads operator ().
- layer8 2y agoIt's not like anyone has a monopoly on the term: https://en.wikipedia.org/wiki/Functor_(disambiguation) https://en.wikipedia.org/wiki/Functor_(disambiguation) The C++ usage was introduced by Jim Coplien in his 1992 book as a succinct name for an architectural pattern in C++: https://archive.org/details/advancedcbsprogr00copl/page/166/mode/2up?q=Functor https://archive.org/details/advancedcbsprogr00copl/page/166/...