列表< T>在C ++/CLI中查找方法
问题描述:
为什么它在C ++/CLI中不起作用?
Why it doesn't work in C++/CLI ?
_list->Remove(_list->Find(x => x.Inode == 2));
我收到错误error C2065: 'x' : undeclared identifier
答
@Hans Passant的评论就是答案,所以我将其粘贴在这里:
@Hans Passant's comment is the answer, so I'm just pasting it here:
C ++/CLI不支持lambda表达式.该语言在2005年被冻结,从那以后没有添加任何新的东西.您将需要显式使用委托. C ++ 11具有lambda,但它们与C ++/CLI不兼容. –汉斯·帕桑特
C++/CLI doesn't support lambda expressions. The language was frozen in 2005, no new bells and whistles were added to it since then. You'll need to use a delegate explicitly. C++11 got lambdas but they are not compatible with C++/CLI. – Hans Passant