Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-09-12 11:36:50


save_null_pointer is not a virtual function and not meant to be overriden
in the derived class. It is an implemenation detail. Hence the cast to the
base
class reference. You shouldn't have a function called save_null_pointer
in your derived class. Look at the other polymorphic archives for examples.

Robert Ramey

Sergey Skorniakov wrote:
> Hello,
> I'm developing custom polymorphic archive and noticed that virtual
> function save_null_pointer is never called for my archive.
>
> I think the problem is in save_pointer_type::invoke
> (boost/archive/detail/oserializer.hpp):
>
> const basic_pointer_oserializer * bpos_ptr =
> register_type(ar, * t); if(NULL == t){
> basic_oarchive & boa =
> boost::smart_cast_reference<basic_oarchive &>(ar);
> boa.save_null_pointer(); save_access::end_preamble(ar);
> return;
> }
> save(ar, * t, bpos_ptr);
>
> I see no reasons to use smart_cast here. I think, the code sholud be:
>
> const basic_pointer_oserializer * bpos_ptr =
> register_type(ar, * t); if(NULL == t){
> ar.save_null_pointer();
> save_access::end_preamble(ar);
> return;
> }
> save(ar, * t, bpos_ptr);
>
> Please correct this in the next release of library (or explain).
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk