Delete assignment and copy constructor

LTO-timing^2
ζeh Matt 2 years ago
parent 3c8ef8463c
commit 8a724eb772
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0

@ -34,8 +34,21 @@ namespace Platform::File {
Handle mHandle{ Handle::Invalid };
public:
ScopedHandle() = default;
ScopedHandle(Handle handle) : mHandle(handle) {}
ScopedHandle() noexcept = default;
ScopedHandle(ScopedHandle& other) = delete;
ScopedHandle(Handle handle) noexcept : mHandle(handle) {}
ScopedHandle(ScopedHandle&& other) noexcept
: mHandle(other.mHandle)
{
other.mHandle = Handle::Invalid;
}
ScopedHandle& operator=(const ScopedHandle& other) = delete;
ScopedHandle& operator=(ScopedHandle&& other) noexcept
{
mHandle = other.mHandle;
other.mHandle = Handle::Invalid;
return *this;
}
~ScopedHandle()
{
if(mHandle != Handle::Invalid)

Loading…
Cancel
Save