Introduce Maps::transform_values()
MODIFY
include/vcpkg/base/util.h
include/vcpkg/base/util.h
#include <algorithm>
#include <map>
#include <mutex>
+#include <unordered_map>
#include <utility>
#include <vector>
@@ -29,6 +30,17 @@ namespace vcpkg::Util
}
}
+ namespace Maps
+ {
+ template<class K, class V1, class V2, class Func>
+ void transform_values(const std::unordered_map<K, V1>& container, std::unordered_map<K, V2>& output, Func func)
+ {
+ std::for_each(container.cbegin(), container.cend(), [&](const std::pair<const K, V1>& p) {
+ output[p.first] = func(p.second);
+ });
+ }
+ }
+
template<class Cont, class Func>
using FmapOut = decltype(std::declval<Func&>()(*begin(std::declval<Cont&>())));

Introduce Maps::transform_values()