Question: What is the meaning of operator() in C++? I see that is often used for "functors," or function objects such as comparators. But then how are such functions called? Is it useful in other situations? And how many parameters can I declare for such an operator? E.g., is the following acceptable?

```
bool operator() (Foo f, Baz b, Quz q, Oik o) {...}

```

Answer: 
One point which I didn't see mentioned, was that although in syntax its invocation looks very similar to that of a regular non-member (dare I say, C-style) function. One difference is that since a functor/function-object is an instance of a class/struct, it can have an associated state.

For non-member functions this could usually mean, either static locals(often times not the best or most useful way to maintain state) or globals(often undesirable). Whereas functors/function objects tie in nicely with C++'s notions on encapsulation where in the state/data is closely tied to the functions that operate on it.

An instructive example of this is:

```
//Declaration
struct instructive_example
{
  instructive_example()
: _invocation_count(0) {};

  uint get_invocation_count() const
  { return _invocation_count; }

  void operator()()
  {
    //Do something

    //And/or operate on the state associated with this function object
    //In this case it is a simple increment of _invocation_count
    ++_invocation_count;
  }
private:
  uint _invocation_count;
};

//Instantiation & invocation:
instructive_example eg;

eg();

```
It's just a normal function that gets called when you apply function-call syntax to a user-defined type.

So it has all the restrictions and features of a regular member function. It can be a template, it can take as many parameters as you want, it needs a return type, it can be `const`, etc.