fs/io/FileReader: add move constructor

This commit is contained in:
Max Kellermann 2015-03-03 20:09:34 +01:00
parent f402c5fe3c
commit f04a3ec201

View File

@ -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();