Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T>
- void remove(std::vector<T>& v, int pos){
- std::vector<T>::iterator it = v.begin();
- std::advance(it, pos);
- v.erase(it);
- }
- template <class T>
- void remove(std::vector<T>& v, int pos){
- v.erase(v.begin()+pos);
- }
- //or why not a swap-n-pop?
- template<typename T>
- void erase(std::vector<T>& v, int pos){
- std::swap(v[pos], v.back());
- v.pop_back();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement