Advertisement
Guest User

Untitled

a guest
May 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <utility>
  2.  
  3. template<class T>
  4. struct Array
  5. {
  6. Array(Array && other) {
  7. swap(other);
  8. }
  9.  
  10. Array& operator=(Array&& other) {
  11. swap(other);
  12. return *this;
  13. }
  14.  
  15. private:
  16. size_t size_ = 0;
  17. T * data_ = nullptr;
  18. size_t capacity_ = 0;
  19.  
  20. void swap(Array& other) {
  21. std::swap(size_, other.size_);
  22. std::swap(data_, other.data_);
  23. std::swap(capacity_, other.capacity_)
  24. }
  25.  
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement