0

Take the following code as an example.

struct A0{};
struct A1: A0{};
struct A2: A0{};

int operator<<(A1& a, int i){}
int operator<<(A2& a, int i){}

using FA0 = int(*)(A0&,int);
using FA1 = int(*)(A1&,int);

int main()
{
    FA0 fa0 = ::operator<<;
}

How can i have fa0 point to the first overloaded << operator? I guess, same question also applies to functions with normal name.

cow
  • 1,050
  • 1
  • 11
  • 18
  • No, my question is a bit different (from that of std::for_each). In my case, the function point is to be assigned to a function pointer of specific type (FA0). I need a explicit cast here. – cow Sep 14 '18 at 20:52
  • However, the answer in the other question does answer to my question. So, question can be dismissed. – cow Sep 14 '18 at 21:00

0 Answers0