|
Boost : |
From: Sergey Skorniakov (s.skorniakov_at_[hidden])
Date: 2007-09-12 17:45:35
save_null_pointer is a pure virtual member function of polymorphic_oarchive and it is overriden in the polymorphic_oarchive_impl (at least, in 1.34.0 version of library). And this function is never called. Its misleading. I think that something should be changed - save_null_pointer should be removed from polymorphic_oarchive or smart_cast_reference from
save_pointer_type::invoke, or, may be, both.
"Robert Ramey" <ramey_at_[hidden]> wrote in message news:fc912i$8m7$1_at_sea.gmane.org...
> 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
>
>
>
> _______________________________________________
> 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