Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
C++: Uniquely addressed
(
pfultz2.com
)
26 points
by
ingve
on May 31, 2015
|
hide
|
past
|
favorite
|
4 comments
hun-nemethpeter
on May 31, 2015
|
prev
[–]
In the first example sum_f() was declared with two parameter but used with zero param.
vmarsy
on May 31, 2015
|
parent
|
next
[–]
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...
hun-nemethpeter
on May 31, 2015
|
root
|
parent
|
next
[–]
Oops.. Yes, you are right.
pfultz2
on May 31, 2015
|
parent
|
prev
[–]
`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: