Commit f04a3ec2 authored by Max Kellermann's avatar Max Kellermann

fs/io/FileReader: add move constructor

parent f402c5fe
...@@ -49,6 +49,20 @@ class FileReader final : public Reader { ...@@ -49,6 +49,20 @@ class FileReader final : public Reader {
public: public:
FileReader(Path _path, Error &error); 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() { ~FileReader() {
if (IsDefined()) if (IsDefined())
Close(); Close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment