Moves a lambda to its own static inline function

This provides better GCC4.4 compability.