Opened 10 years ago

Closed 9 years ago

#7158 closed Patches (fixed)

Add serialization support for std::array

Reported by: Georg Fritzsche <georg.fritzsche@…> Owned by: Robert Ramey
Milestone: Boost 1.51.0 Component: serialization
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

Add support for std::array to boost/serialization/array.hpp where it is available.

Attachments (1)

serialize-std-array.patch (824 bytes ) - added by Georg Fritzsche <georg.fritzsche@…> 10 years ago.
Add support for std::array to serialization/array.hpp

Download all attachments as: .zip

Change History (3)

by Georg Fritzsche <georg.fritzsche@…>, 10 years ago

Attachment: serialize-std-array.patch added

Add support for std::array to serialization/array.hpp

comment:1 by Robert Ramey, 10 years ago

Interesting - this is new to me.

At first I couldn't see the following are different. After looking at the standard I do see a difference.

int x[10];
array<in, 10> x;

I like your implementation - makes sense. But I'm concerned about the possibility of undetected subtlties - like sizeof(x) returning bytes whild x.size() returns elements. Inside the serialzation of an array we use sizeof(x)/sizeof(int) to figure the number of elements. Since <array> supports arrays of zero elements - but I suspect that the sizeof(std::array<int, 0>) is not zero, it's not clear that your implementation isn't bulletproof.

At the very minimum this would need a test to detect implementation quirks in <array>.

Take another look at this.

Robert Ramey

PS. I see now that <array> isn't a replacement for x[] but rather for boost::array. I don't know if we're even testing boost/array.hpp for serialization. RR

comment:2 by Robert Ramey, 9 years ago

Resolution: fixed
Status: newclosed

I've implemented serialization for <array> and checked it into the development branch. It's included in the header boost/serializaiton/array.hpp

Robert Ramey

Note: See TracTickets for help on using tickets.