1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-24 13:43:43 +00:00

Delete assignment and copy constructor

This commit is contained in:
ζeh Matt 2022-07-18 22:28:35 +03:00
parent 3c8ef8463c
commit 8a724eb772
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0

View File

@ -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)