Is it possible to implement events in C++?

前端 未结 4 1334
不思量自难忘°
不思量自难忘° 2021-02-07 10:31

I wanted to implement a C# event in C++ just to see if I could do it. I got stuck, I know the bottom is wrong but what I realize my biggest problem is...

How do I overlo

4条回答
  •  情话喂你
    2021-02-07 11:19

    That is possible, but not with your current design. The problem lies with the fact that the callback function signature is locked into your template argument. I don't think you should try to support this anyways, all callbacks in the same list should have the same signature, don't you think?

提交回复
热议问题