132 | | s = static_pointer_cast<T>((*it).second); |
| 137 | const boost::serialization::extended_type_info * true_type |
| 138 | = boost::serialization::type_info_implementation<T>::type |
| 139 | ::get_const_instance().get_derived_extended_type_info(*r); |
| 140 | if(NULL == true_type) |
| 141 | boost::serialization::throw_exception( |
| 142 | boost::archive::archive_exception( |
| 143 | boost::archive::archive_exception::unregistered_class |
| 144 | ) |
| 145 | ); |
| 146 | const boost::serialization::extended_type_info * this_type |
| 147 | = & boost::serialization::type_info_implementation<T>::type |
| 148 | ::get_const_instance(); |
| 149 | // get this type pointer from pointer to the most derived object. |
| 150 | void * vp = void_upcast( |
| 151 | *true_type, |
| 152 | *this_type, |
| 153 | (*it).second.get() |
| 154 | ); |
| 155 | // make and set shared_ptr. |
| 156 | // data member pn of shared_ptr s shared with (*it).second, |
| 157 | // but data member px of shared_ptr s is vp. |
| 158 | s = shared_ptr<T>((*it).second, static_cast<T *>(vp)); // aliasing |