From b512c7e16f2d67ec15989fc7c387157037dd4758 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jul 2024 16:19:55 +0100 Subject: Add missing truthy/falsy operators to AnyPtr --- lib/stdTypeDefs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/stdTypeDefs.h b/lib/stdTypeDefs.h index beab630..38ebe0b 100644 --- a/lib/stdTypeDefs.h +++ b/lib/stdTypeDefs.h @@ -28,6 +28,18 @@ template struct AnyPtr { return *ptr; } + // NOLINTNEXTLINE(hicpp-explicit-conversions) + operator bool() const + { + return ptr != nullptr; + } + + bool + operator!() const + { + return ptr == nullptr; + } + private: T * ptr; }; -- cgit v1.2.3