More functionality for memory classes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#ifndef ARBUTILS_BORROWEDPTR_HPP
|
||||
#define ARBUTILS_BORROWEDPTR_HPP
|
||||
|
||||
namespace Arbutils::Memory{
|
||||
template <class T>
|
||||
class BorrowedPtr{
|
||||
namespace Arbutils::Memory {
|
||||
template <class T> class BorrowedPtr {
|
||||
T* _ptr;
|
||||
|
||||
public:
|
||||
@@ -11,10 +10,15 @@ namespace Arbutils::Memory{
|
||||
|
||||
inline constexpr T* GetUnsafe() noexcept { return _ptr; }
|
||||
inline constexpr const T* GetUnsafe() const noexcept { return _ptr; }
|
||||
inline constexpr bool IsNull() const noexcept { return _ptr == nullptr; }
|
||||
|
||||
T* operator->() noexcept { return _ptr; }
|
||||
const T* operator->() const noexcept { return _ptr; }
|
||||
|
||||
inline bool operator==(const BorrowedPtr& rhs) const noexcept { return _ptr == rhs._ptr; }
|
||||
inline bool operator!=(const BorrowedPtr& rhs) const noexcept { return _ptr != rhs._ptr; }
|
||||
inline bool operator==(const T* rhs) const noexcept { return _ptr == rhs; }
|
||||
inline bool operator!=(const T* rhs) const noexcept { return _ptr != rhs; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user