An alternative to std :: vector for storing a sequence of objects

I am dealing with several million data items that need to be accessed sequentially. Elements rarely grow and contract, but they do this in known piece sizes in a predictable way.

I am looking for an efficient collection similar to std :: vector, which does not redistribute, but stores data in several pieces of memory. Whenever I insert more objects into the collection, and if the last fragment is exhausted, a new piece is created and filled. I do not want to have a random access operator. I cannot use std :: list due to performance issues and several other issues that are beyond the scope of this question.

Is there a ready-made collection that meets my requirement in boost or any other library. I want to make sure that nothing exists on the shelf before I try to cook something myself.

+4
source share
1 answer

It sounds to me as if your best bet would be the large number of std::vector stored in the B-Tree. B-Tree allows you to refer to areas in memory without visiting them while traversing the tree, providing minimal access to files.

+1
source

Source: https://habr.com/ru/post/1480085/


All Articles