Boost logo

Boost Users :

Subject: Re: [Boost-users] How to serialize basic_string<unsigned char>
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-04-10 19:50:48


Martin Dietze wrote:
> On Sat, April 10, 2010, Robert Ramey wrote:
>
>> BOOST_CLASS_IMPLEMENTATION(std::basic_string<unsigned char>,
>> boost::serialization::primitive_type)
>> with
>> BOOST_CLASS_IMPLEMENTATION(std::basic_string<unsigned char>,
>> boost::serialization::object_type)
>>
>> (double check "object_type") Basically you want the next level of
>> support above primitive_type.
>
> ... which turns out to be `object_serializable' (Serialize the
> objects of this type using the objects "serialize" function or
> template. This permits values to be written/read to/from archives
> but includes no class or version information).
>
>> Also, consider using
>>
>> ar & static_cast<basic_string<char> >(my unsigned string)
>
> This does not compile, obviously there is no way to
> simply assign one to another.
>
> Having used `object_serializable' instead of `primitive_type'
> (same for `object_class_info') got me back to the original
> problem, since there's no builtin `serialize' method for this
> class.

But now you can define an non member serialize template
for you "new" type.

Robert Ramey
>
> Cheers,
>
> M'bert


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