public:
Fd() = default;
explicit Fd(int fd);
- Fd(Fd&& other_fd);
+ Fd(Fd&& other_fd) noexcept;
~Fd();
explicit operator bool() const;
int get() const;
int operator*() const;
- Fd& operator=(Fd&& other_fd);
+ Fd& operator=(Fd&& other_fd) noexcept;
// Close wrapped fd before the lifetime of Fd has ended.
bool close();
{
}
-inline Fd::Fd(Fd&& other_fd) : m_fd(other_fd.release())
+inline Fd::Fd(Fd&& other_fd) noexcept : m_fd(other_fd.release())
{
}
}
inline Fd&
-Fd::operator=(Fd&& other_fd)
+Fd::operator=(Fd&& other_fd) noexcept
{
close();
m_fd = other_fd.release();
public:
File() = default;
File(const std::string& path, const char* mode);
- File(File&& other);
+ File(File&& other) noexcept;
~File();
- File& operator=(File&& other);
+ File& operator=(File&& other) noexcept;
void open(const std::string& path, const char* mode);
void close();
open(path, mode);
}
-inline File::File(File&& other) : m_file(other.m_file)
+inline File::File(File&& other) noexcept : m_file(other.m_file)
{
other.m_file = nullptr;
}
}
inline File&
-File::operator=(File&& other)
+File::operator=(File&& other) noexcept
{
m_file = other.m_file;
other.m_file = nullptr;
// the directory will be created if possible.`
TemporaryFile(nonstd::string_view path_prefix);
- TemporaryFile(TemporaryFile&& other) = default;
+ TemporaryFile(TemporaryFile&& other) noexcept = default;
- TemporaryFile& operator=(TemporaryFile&& other) = default;
+ TemporaryFile& operator=(TemporaryFile&& other) noexcept = default;
// The resulting open file descriptor in read/write mode. Unset on error.
Fd fd;