Boost logo

Boost Users :

Subject: Re: [Boost-users] Compiler does not give error for missing serialize function
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-04-22 15:02:40


On 4/22/16 10:14 AM, Elizabeta wrote:
> Hi
> but private functions from base are not inherited in the derived right? so
> serialize should not be seen in the derived class imho. Also why is not
> wrong, one can forget to write serialize for the derived class.

LOL - good point - you're clearly a smart person. But there's a catch here.

people want to be able to serialize private members. So the
serialization library calls through the serialization::access which is a
friend. This "works around" the normal way of calling a function from a
derived class so the "private" is in effect broken.

So serialization::access basically converts a private "serialize"
function so it means "private except for serialization".

You can see this be puting a debug trap on the serialize function and
running under the debugger and then checking the stack. That should
make clear.

Robert Ramey

>
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/Serialization-Compiler-does-not-give-error-for-missing-serialize-function-tp4685551p4685565.html
> Sent from the Boost - Users mailing list archive at Nabble.com.
>


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