[xsd-users] Polymorphic problems.

Bill Pringlemeir bpringle at sympatico.ca
Mon Dec 1 20:32:08 EST 2008


In the type-serializer-map.hxx and type-serializer-map.hxx, there is a
map typed to,

   typedef
   std::map<const type_id*, type_info, type_id_comparator>
   type_map;

The STL map only need a function like the 'before' implementation.
The problem (or so I believe) is that code like,

   type_serializer_map::find (const type_id& tid) const
   {
      typename type_map::const_iterator i (type_map_.find (&tid));
      return i == type_map_.end () ? 0 : &i->second;
   }


The &tid is taking a pointer to satisify the 'const type_id*' of the
map.  However, the pointer value (memory address) of the typeid(x) is
not always binary.  This can be true if different shared libaries are
used and the compiler has several RTTI structures for identical type
infos.  The C++ standard has an operator== for the type_info for just
this reason.

I think that the key value in 'type_map' should be changed, as the map
will implicitly do an "type_info* == type_info*" to detect a match
with find().  A copy of the type_info or a string would uniquely
determine the map.  Is that correct?

We are having platform dependent problems with polymorphic
serialization and from debugging, this seems to be the problem.

tia,
Bill Pringlemeir.




More information about the xsd-users mailing list