3 ms·
Many 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_
by codeflo 2y ago
Many 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?