shared memory STL maps
Posted
by user306963
on Stack Overflow
See other posts from Stack Overflow
or by user306963
Published on 2010-04-01T14:49:39Z
Indexed on
2010/04/01
14:53 UTC
Read the original article
Hit count: 398
Hello, I am writing an Apache module in C++. I need to store the common data that all childs need to read as a portion of shared memory. Structure is kind of map of vectors, so I want to use STL map and vectors for it. I have written a shared allocator and a shared manager for the purpose, they work fine for vectors but not for maps, below is the example:
typedef vector<CustomersData, SharedAllocator<CustomersData> > CustomerVector; CustomerVector spData; //this one works fine
typedef SharedAllocator< pair< const int, CustomerVector > > PairAllocator;
typedef map< int, CustomerVector, less<int>, PairAllocator > SharedMap;
SharedMap spIndex; //this one doesn't work
I get compile time errors when I try to use the second object (spIndex), which are someting like:
../SpatialIndex.h:97: error: '((SpatialIndex*)this)->SpatialIndex::spIndex' does not have class type
It looks like the compiler cannot determine a type for SharedMap template type, which is strange in my opinion, it seems to me that all the template parameters have been specified.
Can you help?
Thanks Benvenuto
© Stack Overflow or respective owner