Lambdas in C++/CLI

你。 提交于 2019-12-12 08:54:02

问题


How to use lambda expressions in C++/CLI?


回答1:


In C#, lambdas are really just syntactic sugar for creating delegates. C++/CLI supports delegates, so you can still do all of the same stuff in C++/CLI that you can do in C#, you just don't get to use the nifty syntax.




回答2:


I've found this response from a Microsoft employee on the vc blog to a question regarding C++ 0x lambda and managed code interoperability:

You can only pass a variable with a managed type as an argument to a lambda - you can't capture a variable that has a managed type. We have no plans to "merge" lambdas and delegates.




回答3:


According to What's New in Visual C++ 2010 you can use lambda expressions only in VS2010.



来源:https://stackoverflow.com/questions/2642862/lambdas-in-c-cli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!