Boost logo

Boost Users :

From: Sergey Skorniakov (s.skorniakov_at_[hidden])
Date: 2007-10-11 06:06:23


> Thank you for your answer. My application is mono thread and duplicated
> code for seralization is granted to be the same. Our code actually
> forbide this design. What about replacing line 74&75 of
>
> extended_type_info.cpp :
> 74 assert(lookup(eti) == m_self->m_map.end());
> 75 m_self->m_map.insert(eti);
>
> by
>
> if ( lookup(eti) == m_self->m_map.end() )
> {
> m_self->m_map.insert(eti);
> }
>
> ? With this new behavior the same type_info can be registred several time.
>
>
> With this modification my design work fine. I can send you a sample of
> code if you want to investigate the problem
>

This modification will just leads to hard-to-find bugs. Take a look how this information is used in the library - for example, void_caster_compare uses extended_type_info::operator< and it will works wrong (results will be similar as derived class is not registered), because same type infos will be treated as different. Comparison of extended_type_info are also used in basic_archive_impl::helper_compare, in basic_serializer::operator< and may be in some other places. Thus, to support multiple registration, you should provide such extended_type_info::operator< implementation that duplicated type infos from different libs will be equivalent. I had just added double-linked list of extended_type_info to extended_type_info and adds duplicated type infos to the tail of this list. For operator< implemented as comparison of lists heads (first registered type info).
Also, modification of basic_serializer::operator< required because it compares addresses of type infos instead of using extended_type_info::operator<.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net