|
Boost Users : |
Subject: Re: [Boost-users] [serialization] Serializing const* to serializeddata
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-11-06 17:32:11
On Fri, Nov 6, 2009 at 12:36 PM, Robert Ramey <ramey_at_[hidden]> wrote:
> Noah Roberts wrote:
>> In article
>> <c72e33ce0911051651le8017fes28076be7778b87f5_at_[hidden]>,
>> emildotchevski_at_[hidden] says...
>>>
>>> On Thu, Nov 5, 2009 at 4:08 PM, Noah Roberts
>>> <roberts.noah_at_[hidden]> wrote:
>>>>
>>>>
>>>> Consider something like so:
>>>>
>>>> struct A
>>>> {
>>>> ...?
>>>> };
>>>>
>>>> struct B
>>>> {
>>>> std::list<A> items;
>>>> };
>>>>
>>>> struct C
>>>> {
>>>> A const* ptr_to_item_in_B_items;
>>>> };
> All this happens without the programmer/user needing
> to do anything special other than make sure that the
> types are not "untracked". In almost all cases, the
> defaults will give the behavior desired without the programmer/user
> even being aware of it.
Interesting. Then why won't it work with A const *? If I understand
correctly, there are two possibilities for serializing a A const *
pointer:
1) This address has been "seen" before. In this case, you don't
serialize the pointee, and whether or not it is const is irrelevant.
2) The address hasn't been "seen" before, so you new an object of type
A, serialize that, then set the (const) pointer being serialized to A.
Either way, why does it matter if we're dealing with a pointer-to-const?
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
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