Boost logo

Boost Users :

From: Jason Sachs (jmsachs_at_[hidden])
Date: 2008-06-20 15:39:06


does anyone have a simple example of a map in shared memory, where the
key is also in shared memory & not a simple "int"?

I am trying to use a key of type
boost::interprocess::basic_string<wchar_t, ...>, value of type
unsigned long, and I am not sure about the subtleties of using
boost::interprocess::map<>.insert() where the key lives in shared
memory. (the example
http://www.boost.org/doc/libs/1_35_0/doc/html/interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_map
is useful but both the key and value are simple types.)

If I understand right, you have to insert() an instance of the
std::pair<> class. But if the map is in shared memory, does this mean
the std::pair<> also has to live in shared memory as well? (vs. a
local std::pair<> that exists on the stack)

For some reason the basic_string<wchar_t,...> seems to have been
instantiated in some other weird area of memory instead & it's very
difficult to debug + figure out what's going wrong.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net