Boost C++ Libraries: Ticket #7927: boost::bimap not boost::interprocess compatible. https://svn.boost.org/trac10/ticket/7927 <p> I've been trying to get boost::bimap to work in a boost::interprocess::managed_mapped_file. </p> <p> According to Matias Capeletto in this thread on the boost devel mailing list: <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/238100/"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/238100/</a> </p> <blockquote> <p> Bimap is just given your allocator to <a class="missing wiki">MultiIndex</a>. The issue is that the map views (left, right and relation set) are initialized with a reference to the multiindex core in construction time... when interprocess read it from memory the second time this references are garbage. A direct solution will be to use interprocess offset_ptr, but that will have a performance hit so I will have to rethink how the views are accessing the core, probably using CRTP. </p> </blockquote> <p> I've attached two small programs. Both compile with g++ 4.7. One (multiindex.c++) puts a multi_index into the managed_mapped_file. On the first run, it creates the data structure puts some stuff in it, then reopens the data structure and outputs the stuff. On the second run, it does the same thing, but it uses the data stored in the mapped file. </p> <p> The other program (bimap.c++) does exactly the same thing, but when run the second time it crashes. My guess is because bimap isn't quite interprocess compatible---that is, it isn't using the provided allocator for EVERYTHING. </p> <p> Compiled with: </p> <pre class="wiki">g++ -o multiindex multiindex.c++ -lpthread </pre><p> and </p> <pre class="wiki">g++ -g -o bimap bimap.c++ -lpthread </pre><p> Joel </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7927 Trac 1.4.3 jdy@… Fri, 25 Jan 2013 16:34:48 GMT attachment set https://svn.boost.org/trac10/ticket/7927 https://svn.boost.org/trac10/ticket/7927 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bimap.c++</span> </li> </ul> <p> sample code showing bimap w/ interprocess failure </p> Ticket jdy@… Fri, 25 Jan 2013 16:35:30 GMT attachment set https://svn.boost.org/trac10/ticket/7927 https://svn.boost.org/trac10/ticket/7927 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">multiindex.c++</span> </li> </ul> <p> sample code showing multi_index working with interprocess </p> Ticket