vector<int> v{ 1,2,3,4,5,6 };
int total {0};
for_each(v.begin(), v.end(), [&](int n) {total += n; });
Co ta lambda właściwie przechwytuje?
vector<int> v{ 1,2,3,4,5,6 };
int total {0};
for_each(v.begin(), v.end(), [&](int n) {total += n; });
Co ta lambda właściwie przechwytuje?
total