#ifndef __VK_OBJECT_HPP #define __VK_OBJECT_HPP #include "./traits.hpp" #include "./except.hpp" #include namespace vk { template struct object { using id_t = typename id_traits::id_t; object (id_t); id_t& id (void) const&; private: id_t m_id; }; template struct instantiated : public object { using id_t = typename object::id_t; template instantiated (Args &&...args): object (make (std::forward (args)...)) { ; } ~instantiated () { life_traits::destroy (this->id (), nullptr); } private: template static id_t make (Args &&...args) { id_t id; auto res = life_traits::create (std::forward (args)..., &id); error::try_code (res); return id; } }; template struct enumerated : public object { }; template struct owned : public object { }; } #endif