Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] The famous non-const value trap
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-08-26 03:39:55


cc caprani wrote:
> Hi Boosters,
>
> I had the compile time warning discussed here
> (http://boost.2283326.n4.nabble.com/Serialization-C4308-warning-with-MSVC9-td2600175.html)
> that Robert is probably fed up discussing. I've read for months, but
> didn't want to const_cast my object (or is it ok sometimes?).
> However, making my destructor virtual removed the warning. Here's my
> question: why does making the object destructor virtual remove the
> warning, effectively making my object instances const?

That would be a surprise to me
>
> And the section on this trap from the Rationale section of the
> Serialization documentation is not in the1.47 version (howcome?) but
> can be found in previous version here:
> http://www.boost.org/doc/libs/1_39_0/libs/serialization/doc/rationale.html#trap

It used to be an error - but now it's a warning.

Robert Ramey



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