refactor(cleanup): fix pointer implementation

This commit is contained in:
PancakeTAS 2025-11-30 12:53:59 +01:00
parent 18b01050eb
commit 3fc830ad0c

View file

@ -34,13 +34,16 @@ namespace ls {
T* operator->() const { return &this->get(); } T* operator->() const { return &this->get(); }
// moveable // moveable
owned_ptr(owned_ptr&& other) noexcept : ptr(other.ptr) { owned_ptr(owned_ptr&& other) noexcept :
ptr(other.ptr),
deleter(std::move(other.deleter)) {
other.ptr = nullptr; other.ptr = nullptr;
} }
owned_ptr& operator=(owned_ptr&& other) noexcept { owned_ptr& operator=(owned_ptr&& other) noexcept {
if (this != &other) { if (this != &other) {
ptr = other.ptr; ptr = other.ptr;
other.ptr = nullptr; other.ptr = nullptr;
deleter = std::move(other.deleter);
} }
return *this; return *this;