Support for pointer holder outline.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-28 21:08:55 +01:00
parent bfedd15560
commit 872c275bc7
5 changed files with 138 additions and 0 deletions

View 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