
On Friday 25 January 2013 11:20:48 Matias Capeletto wrote:
Hi Joel,
On Thu, Jan 24, 2013 at 10:54 PM, Joel Young <jdy@cryregarder.com> wrote:
I've been trying to get boost::bimap to work in a boost::interprocess::managed_mapped_file.
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.
That is not the problem in this case, Bimap is just given your allocator to MultiIndex. 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.
Is it possible to port both Boost.MultiIndex and Boost.Bimap to Boost.Intrusive? The latter is capable of being process-independent (this feature is used in Boost.Interprocess). I guess this would also simplify Boost.MultiIndex significantly.