Skip to content

Instantly share code, notes, and snippets.

@mochow13
Created September 15, 2018 06:43
Show Gist options
  • Save mochow13/f1c62fe37a5bdf6106b6cf3281e8741d to your computer and use it in GitHub Desktop.
Save mochow13/f1c62fe37a5bdf6106b6cf3281e8741d to your computer and use it in GitHub Desktop.
std::vector<int> c1={1,2,5,5,5,6,9,12};
std::vector<int> c2={2,4,4,5,7,15};
std::vector<int> result; // contains merged elements
std::merge(begin(c1), end(c1), begin(c2), end(c2), std::back_inserter(result));
// result = {1, 2, 2, 4, 4, 5, 5, 5, 5, 6, 7, 9, 12, 15}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment