Delete comparison with nullptr for non-null pointers.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-12-13 11:51:47 +01:00
parent 90bb8d54b6
commit 0e49c58647
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 8 additions and 0 deletions

View File

@ -57,10 +57,14 @@ namespace ArbUt {
inline bool operator==(const BorrowedPtr<T>& rhs) const noexcept { return _raw == rhs._raw; }
/// @brief Check equality of pointers
inline bool operator==(T* 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<T>& rhs) const noexcept { return _raw != rhs._raw; }
/// @brief Check equality of pointers
inline bool operator!=(T* 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 Returns a const version of the underlying pointer.
inline BorrowedPtr<const T> Const() const noexcept { return BorrowedPtr<const T>(_raw); }

View File

@ -61,10 +61,14 @@ namespace ArbUt {
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; }
/// @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; }
/// @brief Delete comparison with nullptr, UniquePtr can't be null
inline bool operator!=(std::nullptr_t) const = delete;
};
}