fd: Make it possible to test fd existence
Change-Id: I85f205bd97c4168729961c68ad74ec15eda1cd12
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/fd/dupable.cpp b/src/fd/dupable.cpp
index d096d04..e9b0982 100644
--- a/src/fd/dupable.cpp
+++ b/src/fd/dupable.cpp
@@ -39,5 +39,10 @@
return handle.value();
}
+DupableFd::operator bool() const noexcept
+{
+ return static_cast<bool>(handle);
+}
+
} // namespace fd
} // namespace stdplus
diff --git a/src/fd/managed.cpp b/src/fd/managed.cpp
index 5669903..b9cfa87 100644
--- a/src/fd/managed.cpp
+++ b/src/fd/managed.cpp
@@ -55,5 +55,10 @@
return handle.value();
}
+ManagedFd::operator bool() const noexcept
+{
+ return static_cast<bool>(handle);
+}
+
} // namespace fd
} // namespace stdplus