It looks like you're right about the problem being the required constructor argument. The hashed_factory
docs say:
The internal hashed container upon which hashed_factory_class is based is constructed with default initialized objects of type Hash, Pred and Allocator.
I wonder if you can work around this by making a subclass of the shared memory allocator that has a default constructor, passing the segment manager to the base class constructor. For example, something like this:
class MyShmAllocator : public ShmFactoryEntryAllocator {
public:
static boost::interprocess::managed_mapped_file::segment_manager *segmentManager;
MyShmAllocator()
: ShmFactoryEntryAllocator(*segmentManager) {
}
};
You would need to assign a "current" MyShmAllocator::segmentManager before any call to the constructor. It's a little ugly but I think it should work.