Advertisement
yepp

swap

Jun 14th, 2014
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1.     template <typename T1, typename ftor1>
  2.     void swap(partitioned_vector<T1, ftor1>& other) {
  3.         std::vector<T1> bazinga;
  4.         bazinga.insert( bazinga.end(), other.t.begin(), other.t.end() );
  5.         bazinga.insert( bazinga.end(), other.f.begin(), other.f.end() );
  6.  
  7.         other.f.clear();
  8.         other.t.clear();
  9.         for (auto e : t) {
  10.             other.insert(e);
  11.         }
  12.         for (auto e : f) {
  13.             other.insert(e);
  14.         }
  15.  
  16.         f.clear();
  17.         t.clear();
  18.         for (auto e : bazinga) {
  19.             insert(e);
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement