Adds documentation and fixes a couple issues.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-12-11 15:22:21 +01:00
parent efdce7b74c
commit d133b0a6fb
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 20 additions and 5 deletions

View File

@ -32,7 +32,7 @@ namespace ArbUt {
_raw = rhs._raw;
return *this;
}
/// @brief Assign operator with raw pointer.
inline BorrowedPtr<T>& operator=(T* rhs) {
if (_raw == &rhs)
return *this;
@ -40,6 +40,7 @@ namespace ArbUt {
_raw = rhs;
return *this;
}
/// @brief Don't allow nullptr assignments
inline BorrowedPtr<T>& operator=(std::nullptr_t) = delete;
/// @brief Operator for access into underlying pointer.

View File

@ -26,12 +26,19 @@ namespace ArbUt {
~OptionalBorrowedPtr() noexcept = default;
/// @brief Copy operator.
inline OptionalBorrowedPtr<T>& operator=(const BorrowedPtr<T>& rhs) {
inline OptionalBorrowedPtr<T>& operator=(const OptionalBorrowedPtr<T>& rhs) {
if (this == &rhs)
return *this;
_raw = rhs._raw;
return *this;
}
/// @brief Assign operator with raw pointer.
inline OptionalBorrowedPtr<T>& operator=(T* rhs) {
if (_raw == &rhs)
return *this;
_raw = rhs;
return *this;
}
/// @brief Return whether the pointer is null or not.
[[nodiscard]] inline bool HasValue() const noexcept { return _raw == nullptr; }

View File

@ -32,7 +32,8 @@ namespace ArbUt {
return *this;
}
inline OptionalUniquePtr<T>& operator=(__attribute__((nonnull)) T* rhs) {
/// @brief Assign operator with raw pointer.
inline OptionalUniquePtr<T>& operator=(T* rhs) {
if (_raw == &rhs)
return *this;
_raw = rhs;

View File

@ -30,17 +30,20 @@ namespace ArbUt {
return *this;
}
/// @brief Assign operator with raw pointer.
inline ScopedPtr<T>& operator=(T* rhs) {
if (_raw == &rhs)
return *this;
AssertNotNull(rhs);
_raw = rhs;
return *this;
}
/// @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* operator->() const noexcept {
AssertNotNull(_raw);
return _raw;
}
/// @brief Get the raw underlying pointer.
inline T* TakeOwnership() const noexcept {

View File

@ -34,6 +34,7 @@ namespace ArbUt {
return *this;
}
/// @brief Assign operator with raw pointer.
inline UniquePtr<T>& operator=(T* rhs) {
if (_raw == &rhs) {
return *this;
@ -43,6 +44,8 @@ namespace ArbUt {
_raw = rhs;
return *this;
}
/// @brief Don't allow nullptr assignments
inline UniquePtr<T>& operator=(std::nullptr_t) = delete;
/// @brief Operator for access into underlying pointer.