io_win32: add move operators to mapped_file

This commit is contained in:
Danny Robson 2019-03-27 19:08:55 +11:00
parent 332d28614b
commit a50624340e
2 changed files with 16 additions and 0 deletions

View File

@ -144,6 +144,19 @@ mapped_file::mapped_file (cruft::posix::fd const &src,
{ };
static BOOL noop (LPCVOID) { return TRUE; }
//-----------------------------------------------------------------------------
mapped_file::mapped_file (mapped_file &&rhs) noexcept
: m_data (nullptr, noop)
{
std::swap (m_file, rhs.m_file);
std::swap (m_mapping, rhs.m_mapping);
std::swap (m_data, rhs.m_data);
std::swap (m_size, rhs.m_size);
}
///////////////////////////////////////////////////////////////////////////////
size_t
mapped_file::size (void) const

View File

@ -70,6 +70,9 @@ namespace cruft {
mapped_file (const mapped_file&) = delete;
mapped_file& operator= (const mapped_file&) = delete;
mapped_file (mapped_file&&) noexcept;
mapped_file& operator= (mapped_file&&) noexcept;
size_t size (void) const;
bool empty (void) const;