Comparing std::functions for equality?

前端 未结 7 519
自闭症患者
自闭症患者 2020-12-03 04:47

How can I compare two C++11 std::functions with operator==, and return true if both of said functions refer to the same f

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-03 05:09

    You could try comparing a and b first by comparing their .target_type() and if these target type ids are the same, then you can compare their .target() pointers. You can use a mismatching target type as an early out false.

提交回复
热议问题