[xsd-users] polymorphic comparison

Boris Kolpackov boris at codesynthesis.com
Tue Jun 10 08:49:06 EDT 2014


Hi Ray,

Ray Lischner <rlischner at proteuseng.com> writes:

> I recently ran into a situation in which I want to compare two objects
> for equality, but all I have are pointers to xsd::cxx::tree::type. That
> is, I need polymorphic comparison to check whether they have the same
> type, and if so, check whether the members are the same.

If the actual types are polymorphic, then:

#include <xsd/cxx/tree/comparison-map.hxx>

xml_schema::type& x = ...
xml_schema::type& y = ...

xsd::cxx::tree::comparison_map<char>& cm (
  xsd::cxx::tree::comparison_map_instance<0, char> ());

bool result (cm.compare (x, y));

Boris



More information about the xsd-users mailing list