MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / transform_map_values

Function transform_map_values

include/fplus/maps.hpp:87–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85// transform_map_values((*2), {0: 2, 1: 3}) == {0: 4, 1: 6}
86template <typename F, typename MapIn>
87auto transform_map_values(F f, const MapIn& map)
88{
89 using MapInPair = typename MapIn::value_type;
90 using Key = std::remove_const_t<typename MapInPair::first_type>;
91 using InVal = std::remove_const_t<typename MapInPair::second_type>;
92 using OutVal = std::decay_t<internal::invoke_result_t<F, InVal>>;
93 using MapOut = typename internal::SameMapTypeNewTypes<MapIn, Key, OutVal>::type;
94
95 return pairs_to_map<MapOut>(
96 transform(
97 bind_1st_of_2(transform_snd<Key, InVal, F>, f),
98 map_to_pairs(map)));
99}
100
101// API search type: map_union_with : (((val, val) -> val), Map key val, Map key val) -> Map key val
102// fwd bind count: 2

Callers 3

map_union_withFunction · 0.70
maps_test.cppFile · 0.50
pairs_test.cppFile · 0.50

Calls 3

transformFunction · 0.70
bind_1st_of_2Function · 0.70
map_to_pairsFunction · 0.70

Tested by

no test coverage detected