MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / mapMerge

Function mapMerge

source/core/StarAlgorithm.hpp:113–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112template <typename MapType1, typename MapType2>
113bool mapMerge(MapType1& targetMap, MapType2 const& sourceMap, bool overwrite = false) {
114 bool noCommonKeys = true;
115 for (auto i = sourceMap.begin(); i != sourceMap.end(); ++i) {
116 auto res = targetMap.insert(*i);
117 if (!res.second) {
118 noCommonKeys = false;
119 if (overwrite)
120 res.first->second = i->second;
121 }
122 }
123 return noCommonKeys;
124}
125
126template <typename MapType1, typename MapType2>
127bool mapsEqual(MapType1 const& m1, MapType2 const& m2) {

Callers 2

mergeMethod · 0.85
mergeMethod · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected