std::vector<std::unique_ptr<ClassBase>>::const_iterator lower_bound(const std::type_index &) const;
public:
+ ClassBase *find_class(const std::type_index &) const;
+
template<typename T>
- Class<T> *find_class() const;
+ Class<T> *find_class() const { return static_cast<Class<T> *>(find_class(typeid(T))); }
template<typename T>
Class<T> &get_or_create_class();
return std::ranges::lower_bound(classes, type, {}, [](auto &c){ return c->get_type(); });
}
-template<typename T>
-inline Class<T> *Reflector::find_class() const
-{
- std::type_index type = typeid(T);
- auto i = lower_bound(type);
- return (i!=classes.end() && (*i)->get_type()==type ? static_cast<Class<T> *>(i->get()) : nullptr);
-}
-
template<typename T>
inline Class<T> &Reflector::get_or_create_class()
{