What is the meaning of “bool operator()(TypeName *n) const” in C++ -
for example
bool operator()(point *p) const; {return f(p->pt);}
is possible returns boolean if true call f?
this overloads function-call operator type, case 1 argument compatible point*
passed. example, if declared on type foo
:
foo foo; point point; // calls operator() method. bool returnvalue = foo(&point);
there nothing magical body of method; call function f
, passing in p->pt
, , return result of expression bool. (what happening within method depends on type of f
.)
Comments
Post a Comment