what does s(...) in the code below mean
It means that you're trying to call s
while passing different arguments 0
, {"--limit"}
, "Limits the number of elements
. For example, s
might be of some class-type that has overloaded the call operator operator()
that takes variable number of arguments.
So by writing:
s(0, {"--limit"}, "Limits the number of elements."); //you're using the overloaded call operator() for some given class type
In the above, you're using the overloaded call operator()
and passing different arguments to it.
Lets look at a contrived example:
struct Custom
{
//overload operator()
template<typename... Args>
void operator()(const Args&...args)
{
std::cout << "operator() called with: "<<sizeof...(args)<<" arguments"<<std::endl;
}
};
template <class Something>
void foo(Something s)
{
s(0, "--limit", "Limits the number of elements."); //call the overloaded operator()
s(false, "--all", "Run all", 5.5, 5); //call the overloaded operator()
}
int main()
{
Custom c; //create object of class type Custom
foo(c); //call foo by passing argument of type `Custom`
}
Demo