Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- struct deep_ptr:
- public std::unique_ptr<T>
- {
- using std::unique_ptr<T>::unique_ptr;
- deep_ptr() {}
- deep_ptr(deep_ptr<T> const& other)
- {
- this->reset(new T(*other.get()));
- }
- deep_ptr(std::unique_ptr<T> other):
- std::unique_ptr<T>( std::move(other) )
- {
- }
- deep_ptr<T>& operator=(deep_ptr<T> const& other)
- {
- this->reset(new T(*other.get()));
- return *this;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment