+// _ _ _ __ _
+// ___| |_ _ __ _ _ ___| |_ _ _ _ __ (_) __ _ _ _ ___ / _| __| |
+// / __| __| '__| | | |/ __| __| | | | | '_ \| |/ _` | | | |/ _ \ | |_ / _` |
+// \__ \ |_| | | |_| | (__| |_ | |_| | | | | | (_| | |_| | __/ | _| (_| |
+// |___/\__|_| \__,_|\___|\__| \__,_|_| |_|_|\__, |\__,_|\___|___|_| \__,_|
+// |_| |_____|
+struct unique_fd {
+ int fd{-1};
+ unique_fd() = default;
+ explicit unique_fd(int f) : fd{f} {}
+ operator int() const { return fd; }
+ ~unique_fd();
+ unique_fd(unique_fd const &) = delete;
+ unique_fd &operator=(unique_fd const &) = delete;
+ unique_fd(unique_fd &&o) : fd(o.fd) { o.fd = -1; }
+ unique_fd &operator=(unique_fd &&o) {
+ std::swap(this->fd, o.fd);
+ return *this;
+ }
+};
+
+#endif // !WM_UTIL_HPP