Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2007-05-06 10:29:08

On 6 May 2007, at 14:38, Peter Dimov wrote:

> Matthias Troyer wrote:
>> On 5 May 2007, at 06:16, Peter Dimov wrote:
>>> * It isn't clear why a guid is marked as a primitive type for
>>> serialization
>>> purposes. Not doing so would allow the macro
>>> to be dropped since
>>> friend class boost::serialization::access;
>>> template<class Archive>
>>> void serialize(Archive &ar, const unsigned int /* file_version
>>> */){
>>> ar & data_;
>>> }
>> One will still need to include the serialization header to serialize
>> boost::array .
> Which serialization header?

Actually there is no serialization support for boost::array yet, and
the test thus should not even compile. Looking more closely I
realized that the test contains the following lines:

     test_archive<text_oarchive, text_iarchive, ostringstream,
     test_archive<xml_oarchive, xml_iarchive, ostringstream,
     //test_archive<binary_oarchive, binary_iarchive, ostringstream,
     test_archive<text_woarchive, text_wiarchive, wostringstream,

The binary test has been commented out exactly because it does not
work since there is no serialization support for boost::array. Why
does it work at all for the text based archives? Digging into the
code I realized that the reason is just that the type is marked as a
primitive type. This means that instead of using the serialize
function of the class, the serialization library requires the archive
to be able to deal with the type directly. This works for tetx based
archives since there is an operator<< to write the guid class into a

Thus, to summarize, the serialization of guid does not work since
there is no serialization support for boost::array yet. This bug was
masked by decalring the type primitive which works - by chance not
not intent - for the text based archives. In order to fix
serialization one has to

- remove the declaration as primitive type
- write serialization support for boost::array
- include that header


Boost list run by bdawes at, gregod at, cpdaniel at, john at