In the Boost.Interprocess documentation Where is this being allocated? it is stated that Boost.Interprocess containers are placed in shared memory using two mechanisms at the same time:
- Boost.Interprocess construct<>, find_or_construct<>... functions. These functions place a C++ object in the shared memory. But this places only the object, not the memory that this object may allocate dynamically.
- Shared memory allocators. These allow allocating shared memory portions so that containers can allocate dynamically fragments of memory to store newly inserted elements.
What is the use case to have a boost.vector where internal memory lives in the current process, but using a shared memory allocator so that elements are placed in shared memory ?
If I want to share this structure to another process :
struct Shared
{
vector<string> m_names;
vector<char> m_data;
};
I guess I want the vectors to be accessible to the other process so that it can iterate on them, right ?