So, I have a function that expects a function pointer as an input, and the prototype of which looks something like this:
int function(int (*op)(int, int));
I was wondering if I can pass an operator for this function pointer. In particular, this built-in statement:
int operator|(int, int);
I tried this:
function(&(operator|));
and got this error:
error: no matching function for call to 'function(<unresolved overloaded function type>)'
I tried this:
function(&(operator|(int, int)));
and got this error:
error: expected primary-expression before 'int'
I looked for this situation in the documentation, but I get information about the "address" of the operator (operator &) instead of things about the address of the operator ....
Edit:
See the previous question Calling primitive operator functions explicitly in C ++
c ++ operators function-pointers
Ned bingham
source share