Boost logo

Boost :

From: Sergey Skorniakov (s.skorniakov_at_[hidden])
Date: 2007-09-12 05:22:09


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).


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