diff --git a/ml.cpp b/ml.cpp index 343e326..d82debc 100644 --- a/ml.cpp +++ b/ml.cpp @@ -1879,6 +1879,7 @@ MlValue map_list(std::vector args, MlEnvironment &env) { throw MlError(MlValue("map_list", map_list), env, args.size() > 2 ? TOO_MANY_ARGS : TOO_FEW_ARGS); std::vector result, list = args[1].as_list(), tmp; + result.reserve(list.size()); for (const auto & item : list) { tmp.push_back(item); result.push_back(args[0].apply(tmp, env));