From f8d2f17a3db5ac490d7b505253a98d6795c2b630 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 29 Nov 2021 21:01:55 +0200 Subject: libcamera: base: shared_fd: Add comparison operators Add == and != comparison operators between two SharedFD instances, and use them to replace manuel get() calls. Signed-off-by: Laurent Pinchart Reviewed-by: Hirokazu Honda Reviewed-by: Jacopo Mondi --- include/libcamera/base/shared_fd.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/libcamera/base/shared_fd.h b/include/libcamera/base/shared_fd.h index 20219224..e53a8b88 100644 --- a/include/libcamera/base/shared_fd.h +++ b/include/libcamera/base/shared_fd.h @@ -46,4 +46,14 @@ private: std::shared_ptr fd_; }; +static inline bool operator==(const SharedFD &lhs, const SharedFD &rhs) +{ + return lhs.get() == rhs.get(); +} + +static inline bool operator!=(const SharedFD &lhs, const SharedFD &rhs) +{ + return !(lhs == rhs); +} + } /* namespace libcamera */ -- cgit v1.2.1