Make ScopedFD's bool operator explicit
This prevents an implicit conversion from bool->int to ensure the user is
calling .get() properly.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I914c0e9583fbfcaa7fafeb0474dbe068716ae19d
diff --git a/aos/scoped/scoped_fd.h b/aos/scoped/scoped_fd.h
index 116985a..e393e89 100644
--- a/aos/scoped/scoped_fd.h
+++ b/aos/scoped/scoped_fd.h
@@ -35,7 +35,7 @@
fd_ = new_fd;
}
}
- operator bool() const { return fd_ != -1; }
+ explicit operator bool() const { return fd_ != -1; }
private:
int fd_;