Supposedly add_options () returns some functor whose operator () is overloaded to support the chain (which is very useful, BTW)
Overloading (...) allows you to create a class that acts as a function.
For instance:
struct func { int operator()(int x) { cout << x*x << endl; } }; ... func a; a(5);
However, if you make a statement (), return a reference to the object, then you can "cling" to the statements.
struct func { func& operator()(int x) { cout << x*x << endl; return *this; } }; ... func a; a(5)(7)(8);
Since a (5) returns a, (a (5)) (7) is more or less identical to a(5); a(7); a(5); a(7); .
source share