From f04a3ec2017d63b8bb48e3d71c6502779a05321a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Mar 2015 20:09:34 +0100 Subject: [PATCH] fs/io/FileReader: add move constructor --- src/fs/io/FileReader.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/fs/io/FileReader.hxx b/src/fs/io/FileReader.hxx index eb0646015..53651380f 100644 --- a/src/fs/io/FileReader.hxx +++ b/src/fs/io/FileReader.hxx @@ -49,6 +49,20 @@ class FileReader final : public Reader { public: FileReader(Path _path, Error &error); +#ifdef WIN32 + FileReader(FileReader &&other) + :path(std::move(other.path)), + handle(other.handle) { + other.handle = INVALID_HANDLE_VALUE; + } +#else + FileReader(FileReader &&other) + :path(std::move(other.path)), + fd(other.fd) { + other.fd.SetUndefined(); + } +#endif + ~FileReader() { if (IsDefined()) Close();