consider non-captured lambda on code generation

it causes an undefined behavior due to the dereference of a returned
value of boost::end().