
David Abrahams wrote:
3. An archive can normally only apply an array optimization to a particular subset of types. This subset varies by archive type and can usually be captured by a type trait such as is_POD or is_fundamental.
In the situations that I've needed it, the subset of types that could be written in a single operation could not be described by a type trait. A type trait can't tell you whether the in-memory representation and the on-disk representation of a type are the same. I just enumerated the types, guarding the overloads with an appropriate #ifdef on endianness. I don't understand how an archive could handle an array of arbitrary PODs.
We'd like to encapsulate that choice in a base class template that allows us to avoid writing complex dispatching logic in each array-optimized archive.
I usually just add the equivalent of a save_sequence( A&, X*, unsigned ) overload for every X that is supported by A.