Hi,
after I go really quick help here from Ion, I've another question.
I managed it to implement a map in shared memory and I'm
able to put pairs into the map in one process and read them in another
process.
To put pair into the map I wrote:
typedef boost::interprocess::allocator
ShmemStringAllocator;
typedef boost::interprocess::basic_string MyString;
MyString key(segment.get_segment_manager());
MyString value(segment.get_segment_manager());
key = "key1";
value = "value1";
mymap->insert(std::pair(key, value));
(For the complete code see http://www.hottis.de/boost/strings/. Thanks.)
What I'm wondering is: will the memory required for key and value be
freed automatically in the writing process (put.C)?
When I like to erase an element from the map, do I need to do more than
just calling mymap->erase(key)?
And finally when I'm done and like to remove the whole map, is more
required than segment.destroy<MyMap>("MyMap")? Will all the MyString's
in the map go too?
Furthermore: is it possible to use a map in shared memory as an
associative array and write:
MyString value = (*mymap)[key];
It doesn't compile for me.
Thanks,
Wolfgang