Will C++0x support __stdcall or extern “C” capture-nothing lambdas?

后端 未结 3 1221
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 03:07

Yesterday I was thinking about whether it would be possible to use the convenience of C++0x lambda functions to write callbacks for Windows API functions.

For exampl

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 03:28

    There's no particularly good reason that this shouldn't be extended to capturing lambdas. It requires some dynamic code generation, but it shouldn't be beyond the wit of compiler writers, and it would make interop with old C APIs orders of magnitude easier--no more need to pass parameters through untyped void*s (which not all APIs even offer).

提交回复
热议问题