On 23/01/2019 21:15, Simon Giddings wrote:
Sorry, but this is a very specific Boost question as we are using the Boost memory mapping system.
You still haven't indicated what library you're talking about. There is no "Boost memory mapping system"; there may or may not be a particular library you are using. But, as previously stated, C++ makes no particular guarantees about the memory layout of class objects and only very minimal guarantees about the layout of POD types. This is especially true cross-platform and cross-toolset, but can bite you when you update the compiler or runtimes within a single platform, or even potentially from one run to another (eg. hash/map ordering can change). If you want portability, then you need to use a serialisation library which implements portability (not all do) along with compatible data structures; but this is an entirely different animal from plain memory mapping.