1 #ifndef DONUT_UNIQUE_HANDLE_HPP
2 #define DONUT_UNIQUE_HANDLE_HPP
58 : handle(other.release()) {}
77 reset(other.release());
87 [[nodiscard]] constexpr
explicit operator bool() const noexcept {
88 return get() != NullHandle;
103 return get() == other.get();
118 Deleter{}(std::exchange(handle, newHandle));
141 return std::exchange(handle, NullHandle);
157 Handle handle = NullHandle;
Generic nullable RAII resource handle with exclusive ownership of a resource that is automatically de...
Definition: UniqueHandle.hpp:21
UniqueHandle(const UniqueHandle &)=delete
Copying a resource handle is disallowed to enforce exclusive ownership.
constexpr Handle get() const noexcept
Get the value of the underlying resource handle.
Definition: UniqueHandle.hpp:152
~UniqueHandle()
Destroy the handle and its associated resource if it has one.
Definition: UniqueHandle.hpp:40
UniqueHandle & operator=(const UniqueHandle &)=delete
Copying a resource handle is disallowed to enforce exclusive ownership.
constexpr void reset(Handle newHandle=NullHandle) noexcept
Destroy the resource associated with this handle, if any, and take ownership of a new resource handle...
Definition: UniqueHandle.hpp:117
constexpr UniqueHandle(UniqueHandle &&other) noexcept
Move constructor.
Definition: UniqueHandle.hpp:57
constexpr bool operator==(const UniqueHandle &other) const noexcept
Compare this resource handle against another for equality of the underlying handle value.
Definition: UniqueHandle.hpp:102
constexpr UniqueHandle() noexcept=default
Construct a null handle without an associated resource.
constexpr UniqueHandle & operator=(UniqueHandle &&other) noexcept
Move assignment.
Definition: UniqueHandle.hpp:76
constexpr Handle release() noexcept
Relinquish ownership of the associated resource.
Definition: UniqueHandle.hpp:140
std::uint32_t Handle
Generic GPU resource handle.
Definition: Handle.hpp:11
Definition: Application.hpp:9