News for hackers. Stuff that matters.
Re:C++ and the Culture of Complexity by mpyne on Friday August 23, 2013 @08:04PM (#6266941)
This is the working code (you have to declare your intention to capture according to the g++ and clang++ error output, and x requires a type in the parameter list):

    auto sum = 0;
    std::for_each(my_vector.begin(), my_vector.end(),
            [&sum](unsigned x) { sum += x; });
I'm sure it could be golfed further though.

There are no comments on this comment yet.