diff --git a/luna/include/luna/OwnedPtr.h b/luna/include/luna/OwnedPtr.h index 319b8160..b831f65f 100644 --- a/luna/include/luna/OwnedPtr.h +++ b/luna/include/luna/OwnedPtr.h @@ -59,6 +59,11 @@ template class OwnedPtr return *m_ptr; } + operator bool() const + { + return m_ptr != nullptr; + } + template friend Result> adopt_shared_from_owned(OwnedPtr&&); private: diff --git a/luna/include/luna/SharedPtr.h b/luna/include/luna/SharedPtr.h index 728cc229..020c37a5 100644 --- a/luna/include/luna/SharedPtr.h +++ b/luna/include/luna/SharedPtr.h @@ -99,6 +99,11 @@ template class SharedPtr return *m_ptr; } + operator bool() const + { + return m_ptr != nullptr; + } + private: T* m_ptr; RefCount* m_ref_count;