
Peter Dimov wrote:
Matthias Troyer wrote:
What if the number n is infinite (e.g. all possible structs consisting only of fundamental types), which is what Robert calls "bitwise serializable"?
Structs aren't bitwise serializable in general because of padding/packing/alignment. Archives that do not have a documented external format and just fwrite whatever happens to be in memory at the time aren't really archives, they are a very specific subset with limited uses (interprocess communication on the same machine, the same compiler and the same version) that should not shape the design. ("Archive" implies persistency, and relying on a specific memory layout is not a way to achieve it.)
However, that is a common use case of any serialization library, and it is one that benefits greatly from fast array serialization. If the serialization library does not support it, those doing IPC may discard boost serialization entirely, to avoid implementing two different mechanisms in their programs. Some operating systems rely extremely heavily on message passing between processes (QNX is an example), and it would be nice if boost.serialization would be useful there. Tom