Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. Vector& operator=(Vector&& other)
  2.     {
  3.  
  4.         if (this->data_ == other.data())
  5.         {
  6.             return *this;
  7.         }
  8.         else
  9.         {
  10.             this->~Vector();
  11.  
  12.             this->size_ = other.size();
  13.             this->capacity_ = other.capacity();
  14.             this->data_ = other.data();
  15.  
  16.             other.data_ = nullptr;
  17.             other.size_ = 0;
  18.             other.capacity_ = 0;
  19.  
  20.             return *this;
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement