Allow blank constructors for pointer types.

This commit is contained in:
Deukhoofd 2020-03-30 17:28:21 +02:00
parent d46b0d798a
commit 6c5fe1bf93
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
4 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ namespace Arbutils::Memory {
T* _ptr;
public:
inline BorrowedPtr() {};
inline explicit constexpr BorrowedPtr(T* ptr) noexcept : _ptr(ptr){};
inline constexpr T* GetUnsafe() noexcept { return _ptr; }

View File

@ -9,6 +9,7 @@ namespace Arbutils::Memory {
T* _ptr;
public:
inline NonNullBorrowedPtr() {};
inline explicit NonNullBorrowedPtr(T* ptr) : _ptr(ptr){
AssertNotNull(ptr);
};

View File

@ -10,6 +10,7 @@ namespace Arbutils::Memory {
T* _ptr;
public:
inline NonNullOwnPtr() {};
inline explicit NonNullOwnPtr(T* ptr) : _ptr(ptr) { AssertNotNull(ptr); };
NonNullOwnPtr<T>(const NonNullOwnPtr<T>&) = delete;

View File

@ -9,6 +9,7 @@ namespace Arbutils::Memory {
T* _ptr;
public:
inline OwnPtr() {};
inline explicit constexpr OwnPtr(T* ptr) noexcept : _ptr(ptr){};
OwnPtr<T>(const OwnPtr<T>&) = delete;