C++ std::function cannot find correct overload

后端 未结 3 638
闹比i
闹比i 2021-02-07 12:19

Consider the following case:

void Set(const std::function &fn);
void Set(const std::function &fn);
3条回答
  •  臣服心动
    2021-02-07 12:38

    I suggest:

      void Set(void(*f)(int, int))
      { 
          std::function wrap(f);
          // ...
      }
    
      void Set(void(*f)(int))
      { 
          std::function wrap(f);
          // ...
      }
    

提交回复
热议问题