diff --git a/object.hpp b/object.hpp index 2f128a5..3c45b30 100644 --- a/object.hpp +++ b/object.hpp @@ -38,7 +38,7 @@ namespace cruft::vk { const id_t& id (void) const&; id_t& id (void) &; - private: + protected: id_t m_id; }; @@ -117,13 +117,31 @@ namespace cruft::vk { template struct owned : public object { using id_t = typename object::id_t; + using owner_t = OwnerT; + using object::object; + template owned (Args &&...args): object (make (std::forward (args)...)) { ; } + + ~owned () + { + CHECK_EQ (this->id (), VK_NULL_HANDLE); + } + + + void + destroy (OwnerT &parent) + { + life_traits::destroy (parent.id (), this->id (), nullptr); + this->m_id = VK_NULL_HANDLE; + } + + private: template static