Skip to content

Commit

Permalink
Re-fix bad sort in type_register_private
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfcgnx committed Mar 18, 2022
1 parent 4f8ad70 commit 2a96dfe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rttr/detail/type/type_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,9 @@ void type_register_private::register_base_class_info(type_data* info)

// sort the base classes after it registration index, that means the root class is always the first in the list,
// followed by its derived classes, here it depends on the order of RTTR_ENABLE(CLASS)
std::sort(base_classes.begin(), base_classes.end(), [](const base_class_info& left, const base_class_info& right)
{ return left.m_base_type.is_base_of(right.m_base_type); });
std::sort(base_classes.begin(), base_classes.end(), [](const base_class_info& left, const base_class_info& right) {
return (left.m_base_type != right.m_base_type) && left.m_base_type.is_base_of(right.m_base_type);
});

if (!base_classes.empty())
{
Expand Down

0 comments on commit 2a96dfe

Please sign in to comment.