C++ supports 'operator overloading', meaning you can define types that support syntax like a + b
. This works by defining functions with names such as operator+
. When an overloadable operator is used with a user defined type C++ looks for functions with these special names and, if a suitable function is found, treats the operator as a function call to the function.
One of the operators that one can overload is the function call operator. A member function named operator()
will be called when you use an object name as though it's a function:
struct S {
void operator() (void) {
std::cout << "Hello, World!\n";
}
};
int main() {
S s;
s(); // prints "Hello, World!\n"
}
It looks like dictionaryConstructorTable::iterator
overloads the function call operator and returns some type that also overloads the function call operator (or just uses the built-in operator).
Replacing the use of the function call operator with normal member functions may make it clearer what's happening:
return autoPtr<LESModel>( cstrIter.foo().bar(U, phi, transport, turbulenceModelName));