win32/handle: add move operators
This commit is contained in:
parent
a69ec062f1
commit
5fa4704456
@ -17,14 +17,6 @@ handle::handle (HANDLE &&h):
|
|||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
handle::handle (handle &&rhs):
|
|
||||||
m_native (rhs.m_native)
|
|
||||||
{
|
|
||||||
rhs.m_native = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
handle::handle (posix::fd &&rhs):
|
handle::handle (posix::fd &&rhs):
|
||||||
m_native (reinterpret_cast<HANDLE> (_get_osfhandle (rhs.release ())))
|
m_native (reinterpret_cast<HANDLE> (_get_osfhandle (rhs.release ())))
|
||||||
@ -33,6 +25,22 @@ handle::handle (posix::fd &&rhs):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
handle::handle (cruft::win32::handle &&rhs) noexcept
|
||||||
|
: handle ()
|
||||||
|
{
|
||||||
|
std::swap (m_native, rhs.m_native);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
handle& handle::operator= (handle &&rhs) noexcept
|
||||||
|
{
|
||||||
|
std::swap (m_native, rhs.m_native);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
handle::~handle ()
|
handle::~handle ()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,9 @@ namespace cruft::win32 {
|
|||||||
handle ();
|
handle ();
|
||||||
explicit handle (posix::fd&&);
|
explicit handle (posix::fd&&);
|
||||||
explicit handle (HANDLE&&);
|
explicit handle (HANDLE&&);
|
||||||
handle (handle&&);
|
|
||||||
|
handle (handle&&) noexcept;
|
||||||
|
handle& operator= (handle&&) noexcept;
|
||||||
|
|
||||||
handle (const handle&) = delete;
|
handle (const handle&) = delete;
|
||||||
handle& operator= (handle const&) = delete;
|
handle& operator= (handle const&) = delete;
|
||||||
|
Loading…
Reference in New Issue
Block a user