From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-06-27 14:38:39


Robert Ramey wrote:
> Vladimir Prus wrote:
>
>> This behaviour will make the case that the current assertion is
>> meant to catch just work.
>
> I believe
>
> a) that it currently works exactly as Peter thinks it should

Almost. This rule:

    - K value saves sharing the same address should be OK and result
        in K copies in the archive;

isn't being followed, and it makes all the difference.

In your example:

> void main(){
> ...
> Y y;
> construct_from x(y);
> ar << x;
> ...
> x.f(); // change x in some way
> ...
> ar << x
> }

the above rule will always output two copies of x, regardless of whether
construct_from is serialized through a pointer in a distant and unrelated
part of the program.

I can think of one situation that could be adversely affected by this
change: virtual base classes will be saved more than once unless their
tracking level is set to 'always'.