一个函数指针名称申明typedef void* (*SFThreadFuncPtr)(void* pUser);
[](void* _This) -> void*{}
为什么这个lambda没办法传给这个SFThreadFuncPtr定义的变量?
怪我咯2017-04-17 15:08:19
The type of
lambda
expression is a closure and cannot be directly assigned to a pointer type. You can use std::function
to wrap the lambda
expression and then call it.
#include <functional>
std::function<void* (void*)> fun;
fun = [](void* _This) -> void* { return NULL;};
fun(NULL);