From 58700afc73efdd9dca23862e09176985f970c5d5 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Tue, 26 Apr 2022 11:25:35 -0400 Subject: [PATCH] Lifetime: Allow checking for empty lifetimes --- include/icsneo/api/lifetime.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/icsneo/api/lifetime.h b/include/icsneo/api/lifetime.h index 702a259..4c9c959 100644 --- a/include/icsneo/api/lifetime.h +++ b/include/icsneo/api/lifetime.h @@ -25,6 +25,10 @@ public: rhs.fnOnDeath = std::function(); return *this; } + + // Allow checking for empty Lifetimes + bool empty() const { return fnOnDeath.operator bool(); } + operator bool() const { return empty(); } private: std::function fnOnDeath; };