1. Array segment.
And what if a class uses a non-standard container? We could use an iterator-based routine:
any user defined type can specify its serialization independent of the archive. With a few special exceptions serialization library has almost no "built in knowledge" of specific types. To see how a custom collection would handled you might just check to see how the stl collections have been handled. They aren't special in any way. The array segment would be an interesting one. For ideas on this one might see how name-value pairs are serialized. also binary object might contain some good ideas. This kind of thing is discussed under the theme "serialization wrappers" in the documention.
The routines for the standard containers could call these primitives. The one for std::vector could use the RT-array primitive.
No one has done valarray so far. There are probably other collections out there that might be interesting as well. No one has submitted any so maybe there is no demand. Or maybe - since is pretty easy, people are just making them, using them and moving on. Or maybe for all I known ot that many people are even using the library .
Finally, a fast archive could be keyed to a type's POD status. (I think we have a type-trait for that.) We would make a subclass of the binary archive class that has overrides for POD types. Those types would dump their bytes directly, even if they're arrays or structures. Obviously we give up portability for speed. My new RT-array primitive should also be optimized for POD types. Non-PODs would call their regular coding function, hopefully getting a speed-up from the individual component speed-ups.
This is a great idea !!! See my response to matthias proposal for my take on it. Robert Ramey