From 0031804fe87bd282c48bd4b63599286b4afac467 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 23 Mar 2022 11:13:42 +0100 Subject: [PATCH] Implements Defines with common defines, initial work on nullability --- src/Defines.hpp | 31 ++++++++++++++++++++++++++ src/Memory/__BorrowedPtr.hpp | 18 +++++++-------- src/Memory/__OptionalBorrowedPtr.hpp | 14 ++++++------ src/Memory/__OptionalScopedPtr.hpp | 14 ++++++------ src/Memory/__OptionalUniquePtr.hpp | 14 ++++++------ src/Memory/__OptionalUniquePtrList.hpp | 27 ++++++++++++---------- src/Memory/__ScopedPtr.hpp | 18 +++++++-------- src/Memory/__UniquePtr.hpp | 14 ++++++------ src/Memory/__UniquePtrList.hpp | 26 ++++++++++----------- 9 files changed, 105 insertions(+), 71 deletions(-) create mode 100644 src/Defines.hpp diff --git a/src/Defines.hpp b/src/Defines.hpp new file mode 100644 index 0000000..dad6923 --- /dev/null +++ b/src/Defines.hpp @@ -0,0 +1,31 @@ +#ifndef ARBUTILS_DEFINES_HPP +#define ARBUTILS_DEFINES_HPP +#include + +using u8 = uint8_t; +using u16 = uint16_t; +using u32 = uint32_t; +using u64 = uint64_t; + +using i8 = int8_t; +using i16 = int16_t; +using i32 = int32_t; +using i64 = int64_t; + +using f32 = float; +using f64 = double; + +#if defined(__clang__) +#define non_null _Nonnull +#else +#define non_null +#endif + +#if defined(__clang__) +#define nullable _Nullable +#else +#define nullable +#endif + + +#endif // ARBUTILS_DEFINES_HPP diff --git a/src/Memory/__BorrowedPtr.hpp b/src/Memory/__BorrowedPtr.hpp index 2c020cb..b8a3e7d 100644 --- a/src/Memory/__BorrowedPtr.hpp +++ b/src/Memory/__BorrowedPtr.hpp @@ -1,8 +1,8 @@ #ifndef ARBUTILS___BORROWEDPTR_HPP #define ARBUTILS___BORROWEDPTR_HPP -#include #include +#include "../Defines.hpp" #include "../Ensure.hpp" namespace ArbUt { @@ -13,12 +13,12 @@ namespace ArbUt { // object. template class BorrowedPtr { private: - T* _raw; + T* non_null _raw; public: inline BorrowedPtr() {} /// @brief Initialise a BorrowedPtr with a specific raw pointer. - inline BorrowedPtr(T* ptr) : _raw(ptr) { EnsureNotNull(ptr); }; + inline BorrowedPtr(T* non_null ptr) : _raw(ptr) { EnsureNotNull(ptr); }; /// @brief Initialise a BorrowedPtr from a copy. inline BorrowedPtr(const BorrowedPtr& other) : _raw(other._raw){}; /// @brief Initialise a BorrowedPtr with a std unique_ptr. @@ -39,7 +39,7 @@ namespace ArbUt { return *this; } /// @brief Assign operator with raw pointer. - inline BorrowedPtr& operator=(T* rhs) { + inline BorrowedPtr& operator=(T* non_null rhs) { if (_raw == rhs) { return *this; } @@ -52,21 +52,21 @@ namespace ArbUt { /// @brief Operator for access into underlying pointer. /// @warning Note that this asserts that the underlying pointer is not null first, to prevent segfaults. - inline T* operator->() const noexcept { return _raw; } + inline T* non_null operator->() const noexcept { return _raw; } /// @brief Get the raw underlying pointer. - inline T* GetRaw() const noexcept { return _raw; } + inline T* non_null GetRaw() const noexcept { return _raw; } /// @brief Check equality of two BorrowedPtr objects inline bool operator==(const BorrowedPtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* non_null rhs) const noexcept { return _raw == rhs; } /// @brief Delete comparison with nullptr, BorrowedPtr can't be null inline bool operator==(std::nullptr_t) const = delete; /// @brief Check equality of two BorrowedPtr objects inline bool operator!=(const BorrowedPtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* non_null rhs) const noexcept { return _raw != rhs; } /// @brief Delete comparison with nullptr, BorrowedPtr can't be null inline bool operator!=(std::nullptr_t) const = delete; @@ -95,7 +95,7 @@ namespace ArbUt { } /// @brief Implicit cast to retrieve raw pointer. - inline operator T*() const noexcept { return _raw; } + inline operator T* non_null() const noexcept { return _raw; } }; } diff --git a/src/Memory/__OptionalBorrowedPtr.hpp b/src/Memory/__OptionalBorrowedPtr.hpp index d37a92f..c31d3cc 100644 --- a/src/Memory/__OptionalBorrowedPtr.hpp +++ b/src/Memory/__OptionalBorrowedPtr.hpp @@ -11,13 +11,13 @@ namespace ArbUt { // object. template class OptionalBorrowedPtr { private: - T* _raw; + T* nullable _raw; public: /// @brief Initialise a BorrowedPtr with a nullptr. inline OptionalBorrowedPtr() : _raw(nullptr) {} /// @brief Initialise a BorrowedPtr with a specific raw pointer. - inline OptionalBorrowedPtr(T* ptr) : _raw(ptr){}; + inline OptionalBorrowedPtr(T* nullable ptr) : _raw(ptr){}; /// @brief Initialise a BorrowedPtr from a copy. inline OptionalBorrowedPtr(const OptionalBorrowedPtr& other) : _raw(other._raw){}; /// @brief Initialise a BorrowedPtr with a std unique_ptr. @@ -34,7 +34,7 @@ namespace ArbUt { return *this; } /// @brief Assign operator with raw pointer. - inline OptionalBorrowedPtr& operator=(T* rhs) { + inline OptionalBorrowedPtr& operator=(T* nullable rhs) { if (_raw == rhs) { return *this; } @@ -46,16 +46,16 @@ namespace ArbUt { [[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; } /// @brief Get the raw underlying pointer. - inline T* GetValue() const noexcept { return _raw; } + inline T* nullable GetValue() const noexcept { return _raw; } /// @brief Check equality of two BorrowedPtr objects inline bool operator==(const OptionalBorrowedPtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* nullable rhs) const noexcept { return _raw == rhs; } /// @brief Check equality of two BorrowedPtr objects inline bool operator!=(const OptionalBorrowedPtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* nullable rhs) const noexcept { return _raw != rhs; } /// @brief Returns a const version of the underlying pointer. inline OptionalBorrowedPtr Const() const noexcept { return OptionalBorrowedPtr(_raw); } @@ -82,7 +82,7 @@ namespace ArbUt { } /// @brief Implicit cast to retrieve raw pointer. - inline operator T*() const noexcept { return _raw; } + inline operator T* nullable() const noexcept { return _raw; } }; } diff --git a/src/Memory/__OptionalScopedPtr.hpp b/src/Memory/__OptionalScopedPtr.hpp index 5cf9c3f..84de1fc 100644 --- a/src/Memory/__OptionalScopedPtr.hpp +++ b/src/Memory/__OptionalScopedPtr.hpp @@ -10,11 +10,11 @@ namespace ArbUt { /// when its owner is deleted. template class OptionalScopedPtr { private: - T* _raw; + T* nullable _raw; public: /// @brief Initialise a ScopedPtr with a specific raw pointer. - inline OptionalScopedPtr(T* ptr) : _raw(ptr){}; + inline OptionalScopedPtr(T* nullable ptr) : _raw(ptr){}; /// @brief Initialise a ScopedPtr from a copy. inline OptionalScopedPtr(const OptionalScopedPtr& other) : _raw(other._raw){}; /// @brief Initialise a ScopedPtr with a std unique_ptr. @@ -32,7 +32,7 @@ namespace ArbUt { } /// @brief Assign operator with raw pointer. - inline OptionalScopedPtr& operator=(T* rhs) { + inline OptionalScopedPtr& operator=(T* nullable rhs) { if (_raw == rhs) { return *this; } @@ -44,22 +44,22 @@ namespace ArbUt { [[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; } /// @brief Get the raw underlying pointer, and take ownership of it. This removes the existing pointer in here. - inline T* TakeOwnership() noexcept { + inline T* nullable TakeOwnership() noexcept { auto raw = _raw; _raw = nullptr; return raw; } /// @brief Get the raw underlying pointer, without taking ownership of it. - inline T* GetValue() noexcept { return _raw; } + inline T* nullable GetValue() noexcept { return _raw; } /// @brief Check equality of two ScopedPtr objects inline bool operator==(const OptionalScopedPtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* nullable rhs) const noexcept { return _raw == rhs; } /// @brief Check equality of two ScopedPtr objects inline bool operator!=(const OptionalScopedPtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* nullable rhs) const noexcept { return _raw != rhs; } /// @brief Implicit cast to retrieve optional borrowed pointer. inline operator OptionalBorrowedPtr() const noexcept { return _raw; } }; diff --git a/src/Memory/__OptionalUniquePtr.hpp b/src/Memory/__OptionalUniquePtr.hpp index c3593f3..b4eeac8 100644 --- a/src/Memory/__OptionalUniquePtr.hpp +++ b/src/Memory/__OptionalUniquePtr.hpp @@ -10,13 +10,13 @@ namespace ArbUt { /// when its owner is deleted. template class OptionalUniquePtr { private: - T* _raw; + T* nullable _raw; public: /// @brief Initialise a BorrowedPtr with a nullptr. inline OptionalUniquePtr() : _raw(nullptr) {} /// @brief Initialise a OptionalUniquePtr with a specific raw pointer. - inline OptionalUniquePtr(T* ptr) : _raw(ptr){}; + inline OptionalUniquePtr(T* nullable ptr) : _raw(ptr){}; /// @brief Initialise a OptionalUniquePtr from a copy. inline OptionalUniquePtr(const OptionalUniquePtr& other) : _raw(other._raw){}; /// @brief Initialise a OptionalUniquePtr with a std unique_ptr. @@ -37,10 +37,10 @@ namespace ArbUt { [[nodiscard]] inline bool HasValue() const noexcept { return _raw != nullptr; } /// @brief Get the raw underlying pointer. - inline T* GetValue() const noexcept { return _raw; } + inline T* nullable GetValue() const noexcept { return _raw; } /// @brief Assign operator with raw pointer. - inline OptionalUniquePtr& operator=(T* rhs) { + inline OptionalUniquePtr& operator=(T* nullable rhs) { if (_raw == rhs) { return *this; } @@ -51,14 +51,14 @@ namespace ArbUt { /// @brief Check equality of two OptionalUniquePtr objects inline bool operator==(const OptionalUniquePtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* nullable rhs) const noexcept { return _raw == rhs; } /// @brief Check equality of two OptionalUniquePtr objects inline bool operator!=(const OptionalUniquePtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* nullable rhs) const noexcept { return _raw != rhs; } /// @brief Implicit cast to retrieve raw pointer. - inline operator T*() const noexcept { return _raw; } + inline operator T* nullable() const noexcept { return _raw; } }; } diff --git a/src/Memory/__OptionalUniquePtrList.hpp b/src/Memory/__OptionalUniquePtrList.hpp index 6b9be62..fd9e69e 100644 --- a/src/Memory/__OptionalUniquePtrList.hpp +++ b/src/Memory/__OptionalUniquePtrList.hpp @@ -1,6 +1,7 @@ #ifndef ARBUTILS___OPTIONALOptionalUniquePtrList_HPP #define ARBUTILS___OPTIONALOptionalUniquePtrList_HPP +#include #include #include "__OptionalBorrowedPtr.hpp" @@ -9,9 +10,9 @@ namespace ArbUt { /// pointers will be called. template class OptionalUniquePtrList { private: - std::vector _vector; - using iterator = typename std::vector::iterator; - using const_iterator = typename std::vector::const_iterator; + std::vector _vector; + using iterator = typename std::vector::iterator; + using const_iterator = typename std::vector::const_iterator; public: /// @brief The type of the value stored in the list. @@ -31,7 +32,9 @@ namespace ArbUt { /// @brief Initialises a OptionalUniquePtrList from a raw pointer range. /// @param begin The raw pointer to the start of the list. /// @param end The raw pointer to the end of the list. - inline OptionalUniquePtrList(ValueT* const* begin, ValueT* const* end) noexcept : _vector(begin, end) {} + inline OptionalUniquePtrList(ValueT* nullable const* non_null begin, + ValueT* nullable const* non_null end) noexcept + : _vector(begin, end) {} OptionalUniquePtrList(const OptionalUniquePtrList&) = delete; OptionalUniquePtrList& operator=(const OptionalUniquePtrList&) = delete; @@ -62,7 +65,7 @@ namespace ArbUt { /// to be done by the taker. /// @param index The index to get the pointer from. /// @return A raw pointer. - ValueT* TakeOwnership(size_t index) { + ValueT* nullable TakeOwnership(size_t index) { auto p = _vector[index]; _vector[index] = nullptr; return p; @@ -79,7 +82,7 @@ namespace ArbUt { /// called. /// @param index The index to set the pointer to. /// @param ptr The pointer to store. - void Set(size_t index, ValueT* ptr) { + void Set(size_t index, ValueT* nullable ptr) { delete _vector[index]; _vector[index] = ptr; } @@ -108,16 +111,16 @@ namespace ArbUt { /// @brief Find the index of the first occurrence of a value in the list, return -1 if none is found. /// @param value The value we want the index for. /// @return The index of the first occurrence of the value in the list, or -1 if none is found. - inline size_t IndexOf(const BorrowedPtr& value) const noexcept { + inline std::optional IndexOf(const BorrowedPtr& value) const noexcept { const auto& it = std::find(_vector.begin(), _vector.end(), value); if (it == _vector.end()) - return -1; + return {}; return std::distance(_vector.begin(), it); } /// @brief Append a pointer to the list. /// @param value The pointer to push to the list. - inline void Append(ValueT* value) { _vector.push_back(value); } + inline void Append(ValueT* nullable value) { _vector.push_back(value); } /// @brief Borrow a pointer at a certain index. /// @param index The index to retrieve. /// @return A borrowed pointer reference to the containing raw pointer. @@ -138,7 +141,7 @@ namespace ArbUt { /// @brief Return a raw pointer to the beginning of the list. /// @return A raw array pointer to the beginning of the list. - ValueT* const* RawData() const noexcept { return _vector.data(); } + ValueT* nullable const* non_null RawData() const noexcept { return _vector.data(); } /// @brief Returns a std::vector representation of the current list. /// @return A std::vector representation of the current list. @@ -149,10 +152,10 @@ namespace ArbUt { /// @brief Returns a raw pointer to the current list. /// @return A raw pointer to the current list. - inline const OptionalUniquePtrList* GetListPointer() const { return this; } + inline const OptionalUniquePtrList* non_null GetListPointer() const { return this; } /// @brief Returns a raw pointer to the current list. /// @return A raw pointer to the current list. - inline OptionalUniquePtrList* GetListPointer() { return this; } + inline OptionalUniquePtrList* non_null GetListPointer() { return this; } }; } diff --git a/src/Memory/__ScopedPtr.hpp b/src/Memory/__ScopedPtr.hpp index e8cebe1..0d7c6b3 100644 --- a/src/Memory/__ScopedPtr.hpp +++ b/src/Memory/__ScopedPtr.hpp @@ -10,11 +10,11 @@ namespace ArbUt { /// when its owner is deleted. template class ScopedPtr { private: - T* _raw; + T* non_null _raw; public: /// @brief Initialise a ScopedPtr with a specific raw pointer. - inline ScopedPtr(T* ptr) : _raw(ptr) { EnsureNotNull(_raw); }; + inline ScopedPtr(T* non_null ptr) : _raw(ptr) { EnsureNotNull(_raw); }; /// @brief Initialise a ScopedPtr from a copy. inline ScopedPtr(const ScopedPtr& other) : _raw(other._raw){}; /// @brief Initialise a ScopedPtr with a std unique_ptr. @@ -36,7 +36,7 @@ namespace ArbUt { } /// @brief Assign operator with raw pointer. - inline ScopedPtr& operator=(T* rhs) { + inline ScopedPtr& operator=(T* non_null rhs) { if (_raw == rhs) { return *this; } @@ -46,30 +46,30 @@ namespace ArbUt { } /// @brief Operator for access into underlying pointer. - inline T* operator->() const noexcept { return _raw; } + inline T* non_null operator->() const noexcept { return _raw; } /// @brief Get the raw underlying pointer, and take ownership of it. This removes the existing pointer in here. - inline T* TakeOwnership() noexcept { + inline T* non_null TakeOwnership() noexcept { auto raw = _raw; _raw = nullptr; return raw; } /// @brief Get the raw underlying pointer, without taking ownership of it. - inline T* GetValue() noexcept { return _raw; } + inline T* non_null GetValue() noexcept { return _raw; } /// @brief Delete comparison with nullptr, ScopedPtr can't be null inline bool operator==(std::nullptr_t) const = delete; /// @brief Check equality of two ScopedPtr objects inline bool operator==(const ScopedPtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* non_null rhs) const noexcept { return _raw == rhs; } /// @brief Check equality of two ScopedPtr objects inline bool operator!=(const ScopedPtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* non_null rhs) const noexcept { return _raw != rhs; } /// @brief Implicit cast to retrieve raw pointer. - inline operator T*() const noexcept { return _raw; } + inline operator T* non_null() const noexcept { return _raw; } /// @brief Implicit cast to retrieve borrowed ptr. inline operator BorrowedPtr() const noexcept { return _raw; } /// @brief Implicit cast to retrieve optional borrowed pointer. diff --git a/src/Memory/__UniquePtr.hpp b/src/Memory/__UniquePtr.hpp index 1ce4411..273626d 100644 --- a/src/Memory/__UniquePtr.hpp +++ b/src/Memory/__UniquePtr.hpp @@ -11,12 +11,12 @@ namespace ArbUt { /// when its owner is deleted. template class UniquePtr { private: - T* _raw; + T* non_null _raw; public: inline UniquePtr() {} /// @brief Initialise a UniquePtr with a specific raw pointer. - inline UniquePtr(T* ptr) : _raw(ptr) { EnsureNotNull(ptr); }; + inline UniquePtr(T* non_null ptr) : _raw(ptr) { EnsureNotNull(ptr); }; /// @brief Initialise a UniquePtr from a copy. inline UniquePtr(const UniquePtr& other) : _raw(other._raw){}; /// @brief Initialise a UniquePtr with a std unique_ptr. @@ -39,7 +39,7 @@ namespace ArbUt { } /// @brief Assign operator with raw pointer. - inline UniquePtr& operator=(T* rhs) { + inline UniquePtr& operator=(T* non_null rhs) { if (_raw == rhs) { return *this; } @@ -54,21 +54,21 @@ namespace ArbUt { /// @brief Operator for access into underlying pointer. /// @warning Note that this asserts that the underlying pointer is not null first, to prevent segfaults. - inline T* operator->() const noexcept { return _raw; } + inline T* non_null operator->() const noexcept { return _raw; } /// @brief Get the raw underlying pointer. - inline T* GetRaw() const noexcept { return _raw; } + inline T* non_null GetRaw() const noexcept { return _raw; } /// @brief Check equality of two UniquePtr objects inline bool operator==(const UniquePtr& rhs) const noexcept { return _raw == rhs._raw; } /// @brief Check equality of pointers - inline bool operator==(T* rhs) const noexcept { return _raw == rhs; } + inline bool operator==(T* non_null rhs) const noexcept { return _raw == rhs; } /// @brief Delete comparison with nullptr, UniquePtr can't be null inline bool operator==(std::nullptr_t) const = delete; /// @brief Check equality of two UniquePtr objects inline bool operator!=(const UniquePtr& rhs) const noexcept { return _raw != rhs._raw; } /// @brief Check equality of pointers - inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; } + inline bool operator!=(T* non_null rhs) const noexcept { return _raw != rhs; } /// @brief Delete comparison with nullptr, UniquePtr can't be null inline bool operator!=(std::nullptr_t) const = delete; }; diff --git a/src/Memory/__UniquePtrList.hpp b/src/Memory/__UniquePtrList.hpp index 40aca2a..8febba3 100644 --- a/src/Memory/__UniquePtrList.hpp +++ b/src/Memory/__UniquePtrList.hpp @@ -10,31 +10,31 @@ namespace ArbUt { /// pointers will be called. template class UniquePtrList { private: - std::vector _vector; - using iterator = typename std::vector::iterator; - using const_iterator = typename std::vector::const_iterator; + std::vector _vector; + using iterator = typename std::vector::iterator; + using const_iterator = typename std::vector::const_iterator; public: /// @brief The type of the value stored in the list. - typedef ValueT* type; + typedef ValueT* non_null type; inline UniquePtrList() noexcept : _vector() {} /// @brief Initialises a UniquePtrList from a std::vector of raw pointers. /// @param vec A std::vector of raw pointers. - inline UniquePtrList(const std::vector& vec) : _vector(vec) { EnsureAllNotNull(vec); } + inline UniquePtrList(const std::vector& vec) : _vector(vec) { EnsureAllNotNull(vec); } /// @brief Initialises a UniquePtrList with a certain capacity reserved for use. This does not set immediate /// size. /// @param capacity The desired capacity. explicit inline UniquePtrList(size_t capacity) : _vector() { _vector.reserve(capacity); } /// @brief Initialises a UniquePtrList from a initialiser_list. /// @param l A initialiser_list - inline UniquePtrList(const std::initializer_list& l) noexcept : _vector(l) { + inline UniquePtrList(const std::initializer_list& l) noexcept : _vector(l) { EnsureAllNotNull(_vector); } /// @brief Initialises a UniquePtrList from a raw pointer range. /// @param begin The raw pointer to the start of the list. /// @param end The raw pointer to the end of the list. - inline UniquePtrList(ValueT* const* begin, ValueT* const* end) noexcept : _vector(begin, end) { + inline UniquePtrList(ValueT* non_null const* non_null begin, ValueT* non_null const* non_null end) noexcept : _vector(begin, end) { EnsureAllNotNull(_vector); } @@ -67,7 +67,7 @@ namespace ArbUt { /// to be done by the taker. /// @param index The index to get the pointer from. /// @return A raw pointer. - ValueT* TakeOwnership(size_t index) { + ValueT* non_null TakeOwnership(size_t index) { auto p = _vector[index]; _vector[index] = nullptr; return p; @@ -84,7 +84,7 @@ namespace ArbUt { /// called. /// @param index The index to set the pointer to. /// @param ptr The pointer to store. - void Set(size_t index, ValueT* ptr) { + void Set(size_t index, ValueT* non_null ptr) { EnsureNotNull(ptr); delete _vector[index]; _vector[index] = ptr; @@ -123,7 +123,7 @@ namespace ArbUt { /// @brief Append a pointer to the list. /// @param value The pointer to push to the list. - inline void Append(ValueT* value) { + inline void Append(ValueT* non_null value) { EnsureNotNull(value); _vector.push_back(value); } @@ -147,7 +147,7 @@ namespace ArbUt { /// @brief Return a raw pointer to the beginning of the list. /// @return A raw array pointer to the beginning of the list. - ValueT* const* RawData() const noexcept { return _vector.data(); } + ValueT* non_null const* non_null RawData() const noexcept { return _vector.data(); } /// @brief Returns a std::vector representation of the current list. /// @return A std::vector representation of the current list. @@ -158,10 +158,10 @@ namespace ArbUt { /// @brief Returns a raw pointer to the current list. /// @return A raw pointer to the current list. - inline const UniquePtrList* GetListPointer() const { return this; } + inline const UniquePtrList* non_null GetListPointer() const { return this; } /// @brief Returns a raw pointer to the current list. /// @return A raw pointer to the current list. - inline UniquePtrList* GetListPointer() { return this; } + inline UniquePtrList* non_null GetListPointer() { return this; } }; }