Skip to content

Instantly share code, notes, and snippets.

@steveobbayi
Created May 23, 2016 21:21
Show Gist options
  • Save steveobbayi/3543e68b834d19728e813bfa4e763992 to your computer and use it in GitHub Desktop.
Save steveobbayi/3543e68b834d19728e813bfa4e763992 to your computer and use it in GitHub Desktop.
vector<int> src = {2,5,3}; // our source of data
vector<int> dest = {0,0,0,0,0,0,0,0,0,0}; // array to be modified
// Lets move all of src to dest
move(src.begin(), src.end(),dest.begin());
// dest is now {2,5,3,0,0,0,0,0,0,0}
// src is now undefined
//lets move src to the end of dest assuming its redefined
move_backward(src.begin(), src.end(),dest.end());
//dest is now {0,0,0,0,0,0,0,2,5,3}
// src is now undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment