The basic rules for processing a lambda require creating a function object that offers operator() with the same signature as the lambda. For each one of the captured fields, you will need to add a member to the functor and initialize it in construction. In your particular case that would be by reference or const reference, depending on where your lambda is being defined and the types involved.
If, for a non-trivial, the lambda was accumulating the value of each element in the vector into a local variable, and (assuming that value3 has the appropriate operators):
struct accumulator__ {
value3 & v_;
accumulator__( value3 & v ) : v_(v) {}
void // for_each ignores the return value
operator()( value3 const * p ) { // same argument as lambda
v_ += *p;
}
};
If the lambda was defined as a member function, and it accessed any member of the class, then things would become a little trickier, but you would basically have to create the closure of all accessed fields manually (i.e. adding [const] references of all the accessed members. Real lambdas (I believe) only capture this but in the refactoring you
may loose access rights to the members of the class.