You can call it what you think is natural.
You are looking for memory mapped files.
Using the right allocator, you can create containers in this area with memory mapping. This will make the container "on disk".
I will see if Boost Circularbuffer supports this directly.
Refresh Yes.
Best of all, it gives you the full ability to even use IPC synchronization and thread synchronization. Using the "private" memory card, you can map the buffer to read and write without writing changes to disk in some processes.
Proof of concept:
Live On Coliru ยน
#include <boost/circular_buffer.hpp> #include <boost/interprocess/allocators/allocator.hpp> #include <boost/interprocess/managed_mapped_file.hpp> namespace bip = boost::interprocess; struct message { int data[32]; }; int main() { bip::managed_mapped_file mmf(bip::open_or_create, "/tmp/circ_buffer.bin", 4ul << 20); typedef bip::allocator<message, bip::managed_mapped_file::segment_manager> allocator; boost::circular_buffer<message, allocator> instance(100, mmf.get_segment_manager()); }
ยน In Coliru, the file size is understandably limited.
sehe
source share