4 ms·
In the first example sum_f() was declared with two parameter but used with zero param.
by hun-nemethpeter 11y ago
In the first example sum_f() was declared with two parameter but used with zero param.
- vmarsy 11y agoNo, 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-objects-in-c++.html http://www.cprogramming.com/tutorial/functors-function-objec...
- hun-nemethpeter 11y agoOops.. Yes, you are right.
- pfultz2 11y ago`sum_f()` is calling the constructor, not the call operator(which would be `sum_f()(1, 2)`).