#pragma once #include "unique_ptr.hpp" namespace common { template UniquePtr::UniquePtr(Target *target) : _target(target) { } template UniquePtr::UniquePtr(UniquePtr &&unique_ptr) noexcept : _target(unique_ptr._target) { unique_ptr._target = nullptr; } template UniquePtr &UniquePtr::operator=(UniquePtr &&unique_ptr) noexcept { if (&unique_ptr != this) { delete _target; _target = unique_ptr._target; unique_ptr._target = nullptr; } return *this; } template UniquePtr::~UniquePtr() { delete _target; } template Target UniquePtr::operator*() const { return *(_target); } template Target *UniquePtr::operator->() const { return _target; } template UniquePtr make_unique(Args... args) { return UniquePtr(new Target(args...)); } } // namespace common