diff --git a/src/Memory/BorrowedPtr.hpp b/src/Memory/BorrowedPtr.hpp index acf9b78..ddca6bb 100644 --- a/src/Memory/BorrowedPtr.hpp +++ b/src/Memory/BorrowedPtr.hpp @@ -6,7 +6,7 @@ namespace Arbutils::Memory { T* _ptr; public: - inline BorrowedPtr() {}; + inline BorrowedPtr() { _ptr = nullptr; }; inline explicit constexpr BorrowedPtr(T* ptr) noexcept : _ptr(ptr){}; inline constexpr T* GetUnsafe() noexcept { return _ptr; } diff --git a/src/Memory/NonNullBorrowedPtr.hpp b/src/Memory/NonNullBorrowedPtr.hpp index af03869..5261d17 100644 --- a/src/Memory/NonNullBorrowedPtr.hpp +++ b/src/Memory/NonNullBorrowedPtr.hpp @@ -9,10 +9,8 @@ namespace Arbutils::Memory { T* _ptr; public: - inline NonNullBorrowedPtr() {}; - inline explicit NonNullBorrowedPtr(T* ptr) : _ptr(ptr){ - AssertNotNull(ptr); - }; + inline NonNullBorrowedPtr(){}; + inline explicit NonNullBorrowedPtr(T* ptr) : _ptr(ptr) { AssertNotNull(ptr); }; inline constexpr T* GetUnsafe() noexcept { return _ptr; } inline constexpr const T* GetUnsafe() const noexcept { return _ptr; } diff --git a/src/Memory/OwnPtr.hpp b/src/Memory/OwnPtr.hpp index 777e395..f5ccaf3 100644 --- a/src/Memory/OwnPtr.hpp +++ b/src/Memory/OwnPtr.hpp @@ -9,7 +9,7 @@ namespace Arbutils::Memory { T* _ptr; public: - inline OwnPtr() {}; + inline OwnPtr() { _ptr = nullptr; }; inline explicit constexpr OwnPtr(T* ptr) noexcept : _ptr(ptr){}; OwnPtr(const OwnPtr&) = delete; @@ -18,16 +18,10 @@ namespace Arbutils::Memory { inline constexpr T* GetUnsafe() noexcept { return _ptr; } inline constexpr const T* GetUnsafe() const noexcept { return _ptr; } - inline constexpr const T* IsNull() const noexcept { - return _ptr == nullptr; - } + inline constexpr const T* IsNull() const noexcept { return _ptr == nullptr; } - inline BorrowedPtr Borrow(){ - return BorrowedPtr(_ptr); - } - inline const BorrowedPtr Borrow() const{ - return BorrowedPtr(_ptr); - } + inline BorrowedPtr Borrow() { return BorrowedPtr(_ptr); } + inline const BorrowedPtr Borrow() const { return BorrowedPtr(_ptr); } T* operator->() noexcept { return _ptr; } const T* operator->() const noexcept { return _ptr; } @@ -39,5 +33,4 @@ namespace Arbutils::Memory { }; } - #endif // ARBUTILS_OWNPTR_HPP