|
Boost : |
Subject: [boost] boost::interprocess mixing heap and shared memory ?
From: Oncaphillis (oncaphillis_at_[hidden])
Date: 2009-04-11 08:26:16
Working with boost::interprocess I came across the following question.
using namespace boost::interprocess;
// ... Assume that I've declared all the necessary allocators
// ... for chars and std::pair<my_string,my_string> here
typedef basic_string<char,my_char_allocator_t> my_string;
typedef
map<my_string,my_string,std::less<my_string>,my_string_string_allocator>
my_map;
managed_shared_memory shm(open_or_create,"BogusMemory",0x1000)
my_map *the_map = some_how_construct_map_in_shared_memory(shm);
// So now I have a map residing in shared memory
// The only way to search within this map I could
// find was the following.
my_map::iterator i =
the_map->find(my_string("BOGUS",my_char_allocator_t(shm)));
This might throw since the search string is constructed within shared
memory
although it is only needed temporary and destructed right after the
statement.
Is there a way to use heap or stack memory for thinks like that ?
Thank you very much
O.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk