mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 20:36:40 +00:00
Delete assignment and copy constructor
This commit is contained in:
parent
3c8ef8463c
commit
8a724eb772
1 changed files with 15 additions and 2 deletions
|
@ -34,8 +34,21 @@ namespace Platform::File {
|
||||||
Handle mHandle{ Handle::Invalid };
|
Handle mHandle{ Handle::Invalid };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScopedHandle() = default;
|
ScopedHandle() noexcept = default;
|
||||||
ScopedHandle(Handle handle) : mHandle(handle) {}
|
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()
|
~ScopedHandle()
|
||||||
{
|
{
|
||||||
if(mHandle != Handle::Invalid)
|
if(mHandle != Handle::Invalid)
|
||||||
|
|
Loading…
Reference in a new issue