Support for pointer holder outline.
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:
21
src/Memory/BorrowedPtr.hpp
Normal file
21
src/Memory/BorrowedPtr.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef ARBUTILS_BORROWEDPTR_HPP
|
||||
#define ARBUTILS_BORROWEDPTR_HPP
|
||||
|
||||
namespace Arbutils::Memory{
|
||||
template <class T>
|
||||
class BorrowedPtr{
|
||||
T* _ptr;
|
||||
|
||||
public:
|
||||
inline explicit constexpr BorrowedPtr(T* ptr) noexcept : _ptr(ptr){};
|
||||
|
||||
inline constexpr T* GetUnsafe() noexcept { return _ptr; }
|
||||
inline constexpr const T* GetUnsafe() const noexcept { return _ptr; }
|
||||
|
||||
T* operator->() noexcept { return _ptr; }
|
||||
const T* operator->() const noexcept { return _ptr; }
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // ARBUTILS_BORROWEDPTR_HPP
|
||||
Reference in New Issue
Block a user