C++0x lambda, how can I pass as a parameter?

后端 未结 3 905
独厮守ぢ
独厮守ぢ 2020-12-10 12:02

Please look at the following C++0x lambda related code:

typedef uint64_t (*WEIGHT_FUNC)(void* param);
typedef std::map Callba         


        
3条回答
  •  春和景丽
    2020-12-10 12:31

    If you really insist on not using function<> then you could probably use decltype:

    typedef decltype([](void*)->uint_64{return 0;}) my_lambda_type;
    

    I really don't recommend this though since you're drastically limiting yourself and I don't even know if two lambda's with the same signature are guaranteed to be the same type.

提交回复
热议问题