folly::merge() - std::merge() with stronger guarantees (probably same implementation in practice)
Summary: std::merge() does not guarantee the ordering when equal elements belong in two ranges(comparator(it_a, it_b) == comparator(it_b, it_a) == 0). For maps, it is important that we can specify the ordering (see array_merge in php, where we guarantee which array's value will be present in the output if a key is present in both inputs). Also removes folly::merge that is specfic for sorted_vector_map since this will not be needed. NOTE: I expect this to break feed, will fix in a separate non-folly diff. Test Plan: This implementation is directly ripped from cppreference.com, but unit tests added none-the-less. Specifically, one is added where the output is a std::map to demonstrate its usefulness. Reviewed By: delong.j@fb.com FB internal diff: D1223401 @override-unit-failures
Showing
folly/Merge.h
0 → 100644
Please register or sign in to comment