Lifetime: Allow checking for empty lifetimes

add-device-sharing
Paul Hollinsky 2022-04-26 11:25:35 -04:00
parent 55d7d5bf17
commit 58700afc73
1 changed files with 4 additions and 0 deletions

View File

@ -25,6 +25,10 @@ public:
rhs.fnOnDeath = std::function<void(void)>(); rhs.fnOnDeath = std::function<void(void)>();
return *this; return *this;
} }
// Allow checking for empty Lifetimes
bool empty() const { return fnOnDeath.operator bool(); }
operator bool() const { return empty(); }
private: private:
std::function<void(void)> fnOnDeath; std::function<void(void)> fnOnDeath;
}; };