Make BucketedTimeSeries::rate() more accurate
[folly.git] / folly / File.h
index 1f30c988be6058d58656e264dad4668415403fdb..e990c91bfc14efcd0274dc01c6c84edf63237315 100644 (file)
@@ -59,6 +59,13 @@ class File {
    */
   int fd() const { return fd_; }
 
+  /**
+   * Returns 'true' iff the file was successfully opened.
+   */
+  explicit operator bool() const {
+    return fd_ >= 0;
+  }
+
   /**
    * If we own the file descriptor, close the file and throw on error.
    * Otherwise, do nothing.