We already briefly touched on some aspects of serialization in Chapter 3, Working with Different Architectures. When it comes to data exchange, serialization is crucial. The task of serialization is to represent all data being sent by the sender application in a way that can be unambiguously read by the receiver application. This task is not that straightforward, given that the sender and the receiver may be running on different hardware platforms and connected over a variety of transport links—a Transmission Control Protocol/Internet Protocol (TCP/IP) network, a Serial Peripheral Interface (SPI) bus, or a serial link.
There are many different ways of implementing serialization depending on requirements, which is why the C++ standard library does not provide it out of the box.
In this recipe, we will learn...