I am working with boost multi index in shared memory
I create a struct SrHpackHeaderElement that contain shared strings
struct SrHpackHeaderElement
{
SrHpackHeaderElement(char_allocator* pCharAllocator):m_sName("",pCharAllocator),m_sValue("",pCharAllocator){}
shm_string m_sName;
shm_string m_sValue;
};
The same struct is used in a shared vector
typedef bip::managed_shared_memory::allocator<SrHpackHeaderElement>::type HpackHeader_allocator;
typedef bip::allocator<SrHpackHeaderElement, HpackHeader_allocator> HpackHeader_ShmemAllocator;
typedef bip::vector<SrHpackHeaderElement, HpackHeader_ShmemAllocator> HpackTableType;
struct CrHttp2HpackValue
{
HpackTableType m_table;
CrHttp2HpackValue(HpackHeader_ShmemAllocator * pHpackHeaderShmemAllocator,char_allocator* pCharAllocator):m_table(pHpackHeaderShmemAllocator)
{
}
};
I want to pass the allocator to the struct constructor CrHttp2HpackValue, and to initialize the shared/interprocess vector Is this possible?
I put the code in the following link https://coliru.stacked-crooked.com/a/46b96c0a70a165b9