Skip to content

Instantly share code, notes, and snippets.

@mochow13
Last active September 18, 2018 16:30
Show Gist options
  • Save mochow13/9afd44ad68058151025b4c38f24b17c6 to your computer and use it in GitHub Desktop.
Save mochow13/9afd44ad68058151025b4c38f24b17c6 to your computer and use it in GitHub Desktop.
std::vector<int> collection={6,5,3,2,1,4,6,7};
std::vector<int> diffs;
std::adjacent_difference(begin(collection), end(collection), std::back_inserter(diffs));
// The first element of diffs will be same as the first element of collection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment