chh*_*ing 2 c++ lambda visual-studio-2010 visual-c++ c++11
我有一个嵌套的lambda函数的问题,它无法看到静态类成员.由于我无法理解的原因,Visual Studio 2010为我提供了C2065(未声明的标识符).
这是一个简单的案例,突出了我的问题:
#include <algorithm>
#include <vector>
using namespace std;
struct foo
{
void do_some()
{
std::vector<int> a;
std::vector<int> b;
for_each( a.begin(), a.end(), [&] ( const int& m )
{
// works
auto j = _i + 1;
for_each( b.begin(), b.end(), [&] ( const int& n )
{
**// doesn't work**
auto k = _i + 1;
} );
} );
}
static int _i;
};
int main(int argc, char* argv[])
{
}
Run Code Online (Sandbox Code Playgroud)
谁知道我做错了什么?
谢谢,克里斯蒂安
归档时间: |
|
查看次数: |
314 次 |
最近记录: |