如何将成员函数指针赋给非成员函数指针?

时间:2015-09-27 06:12:27

标签: c++ boost-bind

如何将成员函数指针指定给非成员函数指针?

我有这个库API函数:

int pfring_loop(pfring *ring, pfringProcesssPacket looper,
        const u_char *user_bytes, u_int8_t wait_for_packet);

API定义的函数指针:

typedef void (*pfringProcesssPacket)(const struct pfring_pkthdr *h, const u_char *p, const u_char *user_bytes);

我的会员功能:

template<class DERIVED> void pf_ring_impl<DERIVED>::pf_ring_packet_handler(const struct pfring_pkthdr *h, const u_char *p, const u_char *user_bytes)

我如何调用但编译错误

pfring_loop(pd_, boost::bind(reinterpret_cast<pfringProcesssPacket>(&pf_ring_impl<DERIVED>::pf_ring_packet_handler), this, _1, _2, _3), (u_char*) NULL, wait_for_packet_);

0 个答案:

没有答案