Adds documentation and fixes a couple issues.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
efdce7b74c
commit
d133b0a6fb
|
@ -32,7 +32,7 @@ namespace ArbUt {
|
||||||
_raw = rhs._raw;
|
_raw = rhs._raw;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/// @brief Assign operator with raw pointer.
|
||||||
inline BorrowedPtr<T>& operator=(T* rhs) {
|
inline BorrowedPtr<T>& operator=(T* rhs) {
|
||||||
if (_raw == &rhs)
|
if (_raw == &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -40,6 +40,7 @@ namespace ArbUt {
|
||||||
_raw = rhs;
|
_raw = rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
/// @brief Don't allow nullptr assignments
|
||||||
inline BorrowedPtr<T>& operator=(std::nullptr_t) = delete;
|
inline BorrowedPtr<T>& operator=(std::nullptr_t) = delete;
|
||||||
|
|
||||||
/// @brief Operator for access into underlying pointer.
|
/// @brief Operator for access into underlying pointer.
|
||||||
|
|
|
@ -26,12 +26,19 @@ namespace ArbUt {
|
||||||
~OptionalBorrowedPtr() noexcept = default;
|
~OptionalBorrowedPtr() noexcept = default;
|
||||||
|
|
||||||
/// @brief Copy operator.
|
/// @brief Copy operator.
|
||||||
inline OptionalBorrowedPtr<T>& operator=(const BorrowedPtr<T>& rhs) {
|
inline OptionalBorrowedPtr<T>& operator=(const OptionalBorrowedPtr<T>& rhs) {
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
_raw = rhs._raw;
|
_raw = rhs._raw;
|
||||||
return *this;
|
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.
|
/// @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; }
|
||||||
|
|
|
@ -32,7 +32,8 @@ namespace ArbUt {
|
||||||
return *this;
|
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)
|
if (_raw == &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
_raw = rhs;
|
_raw = rhs;
|
||||||
|
|
|
@ -30,17 +30,20 @@ namespace ArbUt {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Assign operator with raw pointer.
|
||||||
inline ScopedPtr<T>& operator=(T* rhs) {
|
inline ScopedPtr<T>& operator=(T* rhs) {
|
||||||
if (_raw == &rhs)
|
if (_raw == &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
AssertNotNull(rhs);
|
|
||||||
_raw = rhs;
|
_raw = rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Operator for access into underlying pointer.
|
/// @brief Operator for access into underlying pointer.
|
||||||
/// @warning Note that this asserts that the underlying pointer is not null first, to prevent segfaults.
|
/// @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.
|
/// @brief Get the raw underlying pointer.
|
||||||
inline T* TakeOwnership() const noexcept {
|
inline T* TakeOwnership() const noexcept {
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace ArbUt {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Assign operator with raw pointer.
|
||||||
inline UniquePtr<T>& operator=(T* rhs) {
|
inline UniquePtr<T>& operator=(T* rhs) {
|
||||||
if (_raw == &rhs) {
|
if (_raw == &rhs) {
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -43,6 +44,8 @@ namespace ArbUt {
|
||||||
_raw = rhs;
|
_raw = rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Don't allow nullptr assignments
|
||||||
inline UniquePtr<T>& operator=(std::nullptr_t) = delete;
|
inline UniquePtr<T>& operator=(std::nullptr_t) = delete;
|
||||||
|
|
||||||
/// @brief Operator for access into underlying pointer.
|
/// @brief Operator for access into underlying pointer.
|
||||||
|
|
Loading…
Reference in New Issue