Hacker News new | ask | show | jobs
by hun-nemethpeter 4205 days ago
In the first example sum_f() was declared with two parameter but used with zero param.
2 comments

No, sum_f is a functor, only its operator() is overloaded to receive 2 parameters, the constructor of the struct is a default constructor that takes no argument.

http://www.cprogramming.com/tutorial/functors-function-objec...

Oops.. Yes, you are right.
`sum_f()` is calling the constructor, not the call operator(which would be `sum_f()(1, 2)`).