std :: function :: target无法获得成员函数,虽然我使用的是bool类型(AAA :: *)(uint32_t,uint64_t,uint32_t

时间:2017-10-13 06:45:17

标签: c++11

代码输出0而不是地址 std :: function :: target虽然使用bool(AAA :: *)类型(u​​int32_t,uint64_t,uint32_t),但仍无法获得成员函数

#include <functional>
#include <iostream>

#include <typeinfo>
typedef std::function<bool (uint32_t , uint64_t , uint32_t )> CheckHandler;


struct AAA {
    bool IsShouldWrite (uint32_t log_id, uint64_t uid, uint32_t priority) {}
};

int main() {
    AAA a;

    CheckHandler check_handler =std::bind(&AAA::IsShouldWrite, &a, std::placeholders::_1,std::placeholders::_2,std::placeholders::_3);
    std::cout<<check_handler.target<bool (AAA::*)(uint32_t , uint64_t , uint32_t )>();
}

0 个答案:

没有答案