How is this line printing the array?
pI am kind of new to C++, and while I was reading some code today, I
stumbled upon something like this:/p precodeint v[5] = {1, 13, 17, 20,
16}; for_each(begin(v), end(v), [](int n){ cout lt;lt; n lt;lt; endl; });
/code/pre pI kind of understand what is going on. It is printing all the
values of array v[], using the std::for_each function. But what is the
deal with code[](int n){ cout lt;lt; n lt;lt; endl; }/code?/p
No comments:
Post a Comment