X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Freflection.cpp;h=43dd13a73e1c8ba01a64678aec85975213eb3eb8;hb=3643555f600e4580059f75032135ee4f452cf18b;hp=d188e5081be09bccd32b605f7856f5dd84a31b67;hpb=c71b8c2151e097f435c8f76ffa123cc71f9d12ec;p=libs%2Fgame.git diff --git a/source/game/reflection.cpp b/source/game/reflection.cpp index d188e50..43dd13a 100644 --- a/source/game/reflection.cpp +++ b/source/game/reflection.cpp @@ -24,5 +24,12 @@ bool ClassBase::is_base_of(const ClassBase &other) const return ranges::any_of(other.bases, [this](const ClassBase *b){ return is_base_of(*b); }); } + +ClassBase *Reflector::find_class(const type_index &type) const +{ + auto i = lower_bound(type); + return (i!=classes.end() && (*i)->get_type()==type ? i->get() : nullptr); +} + } // namespace Reflection } // namespace Msp::Game