Hi,
I'm a complete newbie with boost and have a question concerning the
interprocess stuff.
I took the piece of code to share a vector in shared memory between two
processes from the quick-start guide as a start point and it compiled
and ran immediately with success for me.
Then I tried to replace the vector by a map:
#include
#include
#include
using namespace std;
int main ()
{
boost::interprocess::shared_memory_object::remove("MySharedMemory");
boost::interprocess::managed_shared_memory
segment(boost::interprocess::create_only, "MySharedMemory"
,65536); //segment size in bytes
typedef pair MyPair;
typedef boost::interprocess::allocator ShmemAllocator;
typedef boost::interprocess::map
MyMap;
const ShmemAllocator alloc_inst (segment.get_segment_manager());
MyMap *mymap = segment.construct<MyMap>("MyMap")(alloc_inst);
// mymap->insert(make_pair(1,10));
// mymap->insert(make_pair(2,20));
// mymap->insert(make_pair(3,30));
// mymap->insert(make_pair(4,40));
// mymap->insert(make_pair(5,50));
return 0;
}
and I wasn't able to compile it any more. (I've put the error message
and the sources on the web, find it here: http://www.hottis.de/boost/)
I think it is the segment.construct line, although I don't find a direct
hint in the error message from the compiler, but if I comment out this
line, the compiler is happy.
Has any one any hint for me?
Thank you very much,
Wolfgang