#pragma once #include #include namespace intellect { namespace level0 { template typename vref> struct refmixin { using links_t = std::multimap; using array = std::vector; void link(ref const & type, ref const & target) { p()->link(conv(type), conv(target)); } void unlink(ref const & type, ref const & target) { p()->unlink(conv(type), conv(target)); } void unlink(ref const & type) { p()->unlink(conv(type)); } bool linked(ref const & type) const { return p()->linked(conv(type)); } bool linked(ref const & type, ref const & target) const { return p()->linked(conv(type), conv(target)); } array getAll(ref const & type) const { return conv(p()->getAll(conv(type))); } links_t & links() const { return *(links_t*)&(p()->links); } ref get(ref const & type) const { return conv(p()->get(conv(type))); } void set(ref const & type, ref const & target) { p()->set(conv(type), conv(target)); } template vref vget(ref const & type) const { return conv>(get(type)); } bool operator==(ref const & other) const { return self.p() == other.p(); } bool operator!=(ref const & other) const { return self.p() == other.p(); } bool operator<(ref const & other) const { return self.p() < other.p(); } private: inline concept * p() const { return *conv(this); } using r = level0::ref; template static inline OUT conv(IN r) { return *(OUT*)&r; } }; } }