Tell us about the data. Is each element large or small? Is it fixed or variable? The problem with disk storage is that as the elements become more diverse in size, the more the problem begins to resemble a database problem. In this case, you should probably look at something like a sqllite database as a backup storage in your queue. Then you can simply use SQL to pull the first record.
If the data is really big, you can simply save each object in the file system using file name increment. Then you do not even need to store the queue in memory. The file date will become your FIFO order. Just grab the oldest file in the directory to pull the first item from the stack.
Finally, if the data is small and plentiful, you can consider overriding Allocator for std :: list or std :: deque. Perhaps you can hide the IO file in the Allocator class. I do not have a simple solution for a small and numerous instance of data.
jmucchiello
source share