我有一个功能,如:C++,使用lambda实现typedef?
typedef void(*timercallback)(void);
void timer1_attachInterrupt(timercallback userFunc);
我想调用成员方法,而不是C风格的函数,所以我曾尝试以下拉姆达:
timer1_attachInterrupt([this](void) -> void { _member_method(); });
但是我得到的编译器错误:
No suitable conversion function from "lambda [] void() -> void" to "timercallback" exists
据我所见,lambda具有类似于typedef的void参数,并返回void类似于tyepdef。我错过了什么?
Arundo?如果是这样添加标签。 – Yakk