Functor
From Conservapedia
This is an old revision of this page, as edited by Barack (Talk | contribs) at 18:23, January 28, 2013. It may differ significantly from current revision.
The term functor has two distinct meanings.
cumming on my face oh yes sweet milk
In Computer Science
In computer science, the term "functor" is short for "function operator", also called a "function object". It is essentially a class method with no name. Many modern programming languages support this. For example, in C++ one can define a function object with the "operator()" notation, that is, a definition of what parentheses mean after an object.
class C {
public:
int operator()(int i, int j) { return k+i*j; }
int k;
.....
};
.....
C MyObject;
MyObject.k = 3;
int r = MyObject(4,5);
.....
We have effectively defined a nameless method for class C. Instead of making a named invocation like "MyObject.func(4,5)", we just write "MyObject(4,5)".