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

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -