Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. template<typename U>
  2. struct Target__
  3. {
  4. protected:
  5.  
  6.     U   *entries_ = nullptr;
  7.     int size_;
  8. public:
  9.  
  10. Target__<U> operator=(Target__<U> &other) {
  11.         size_ = other.size_;
  12.         if (size_ > 0) {
  13.             entries_ = std::copy(other.entries_, other.entries_ + size_, new U[size_]);
  14.             return *this;
  15.         } else {
  16.             throw (std::out_of_range("Size of Target cannot be Zero"));
  17.         }
  18.     }
  19.  
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement