Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
C++: Uniquely addressed (pfultz2.com)
26 points by ingve on May 31, 2015 | hide | past | favorite | 4 comments


In the first example sum_f() was declared with two parameter but used with zero param.


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)`).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: