mrdocs::CompareDerived

Compares two polymorphic objects that have visit functions

Synopsis

Declared in <mrdocs/ADT/Polymorphic.hpp>

template<class Base>
requires detail::CanVisitCompare<Base>
auto
CompareDerived(
    Polymorphic<Base> const& lhs,
    Polymorphic<Base> const& rhs);

Description

This function compares two Polymorphic objects that have visit functions for the Base type.

The visit function is used to compare the two objects if they are of the same derived type.

If the two objects are of different derived types, the comparison is based on the type_info of the derived types.

If any of the objects is empty, the comparison is based on the emptiness of the objects.

Return Value

true if the two Polymorphic objects are equal, otherwise false.

Template Parameters

NameDescription
BaseThe type of the Polymorphic.

Parameters

NameDescription
lhsThe first Polymorphic to compare.
rhsThe second Polymorphic to compare.