From 9f064c1e25e631fc0b0eb0b06438583b2cccb632 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 12 Dec 2020 11:37:19 +0100 Subject: [PATCH] Fixes optional pointers. --- src/Memory/__OptionalBorrowedPtr.hpp | 2 +- src/Memory/__OptionalUniquePtr.hpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Memory/__OptionalBorrowedPtr.hpp b/src/Memory/__OptionalBorrowedPtr.hpp index 17958e7..c08fb60 100644 --- a/src/Memory/__OptionalBorrowedPtr.hpp +++ b/src/Memory/__OptionalBorrowedPtr.hpp @@ -43,7 +43,7 @@ namespace ArbUt { } /// @brief Return whether the pointer is null or not. - [[nodiscard]] inline bool HasValue() const noexcept { return _raw == nullptr; } + [[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; } /// @brief Get the raw underlying pointer. inline T* GetValue() const noexcept { return _raw; } diff --git a/src/Memory/__OptionalUniquePtr.hpp b/src/Memory/__OptionalUniquePtr.hpp index c0cb71e..18bcc5e 100644 --- a/src/Memory/__OptionalUniquePtr.hpp +++ b/src/Memory/__OptionalUniquePtr.hpp @@ -33,6 +33,12 @@ namespace ArbUt { return *this; } + /// @brief Return whether the pointer is null or not. + [[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; } + + /// @brief Get the raw underlying pointer. + inline T* GetValue() const noexcept { return _raw; } + /// @brief Assign operator with raw pointer. inline OptionalUniquePtr& operator=(T* rhs) { if (_raw == rhs) {