Boost logo

Boost :

Subject: Re: [boost] [serialization] serializing std::string*
From: Zach Laine (whatwasthataddress_at_[hidden])
Date: 2008-12-17 13:00:00


On Wed, Dec 17, 2008 at 10:46 AM, Robert Ramey <ramey_at_[hidden]> wrote:
> Zach Laine wrote:
>> FWIW, some_archive & some_std_string doesn't even compile with Boost
>> 1.36 and 1.37, with GCC 4.1.0.
>
> The serialization tests suite explicitly tests serialization of std::string
> on all
> platforms and compilers and archives and they all pass so maybe you're
> doing something wrong.

Sorry, I meant "some_std_string_pointer".

>> So, why didn't you do a trick like the one used below, and save a
>> std::string-derived type instead of a std::string?
>
> This trick can only be used to turn a primitive into a serializable
> type - not the other way around.

I was referring to your statement that you need to serialize
std::strings in the archive header. My point is just that it seems
more appropriate to write some std::string-equivalent (apparently not
using the trick you recommended to me, but perhaps something like a
size S followed by S chars?) in the archive header, instead of forcing
user code to treat std::string as a primitive type.

>>Now users have to
>> figure out this trick and presumably have to post to this list, since
>> none of this is documented AFAICT.
>
> Maybe you should look for a better documented serialization library.

I'm just trying to make the one I use better, instead of starting from scratch.

> If you want, you could submit a documentation patch as a TRAK item.

Will do.

Zach


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk