Boost logo

Boost :

From: michel.andre_at_[hidden]
Date: 2001-07-26 12:46:09


Would there be any interest in an persistent vector with the exact
same interface as std::vector that stores it's data in a persistent
file? Preferably implemented using memory mapped files on plattforms
were they are supported.

Other stl containers could also be adapted to use persistent storage
in this way.

The proposed interface is that of std::vector only that all
constructors take a first argument which is a filename for the file
were the data is stored.

Sample code snippet

{
   mapped_vector<int> vec("sample.dat");
   vec.push_back(1);
   vec.push_back(2);
   vec.push_back(3);
}

{
   mapped_vector<int> vec("sample.dat");
   // vector now contains 1,2,3
   vec.push_back(4);
   vec.push_back(5);
   vec.push_back(6);
}

// vector now contains 1,2,3,4,5,6

I have implemented a test version for Windows NT and i guess a unix
version could be done using the mmap* family of functions.

Of course there are restrictions on the data contained in such a
vector it may not contain any dynamically allocated data or pointers.

/Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk