Function Pointer to a Standard Operator

How would I go about passing one?

I have these functions:
1
2
3
4
5
6
void bitwise_helper(
    FOO& f, FOO s,
    std::function<bool(bool, bool)> operation
);
FOO& FOO::operator&=(const FOO& rhs)
    {return bitwise_helper(*this, rhs, std::operator&=), *this;}


But when I try to compile this, I get "cannot resolve overloaded function operator&= based on conversion to type std::function<bool(bool, bool)>".
Did I write the correct types?

If I try using a template to generalize the last parameter instead of using std::function, I get "no known conversion for bitwise_helper(FOO&, FOO, <unresolved external symbol>)".



Appreciate any help.
~Daleth~

Edit:
Nevermind. Felt like an idiot when I realized I forgot to make the types references. Corrected instantiation of std::function:
 
std::function<bool&(bool&, bool)>
Last edited on
Topic archived. No new replies allowed.