Replace lambda by a std::function (may be fix the problem on g++)