I'm looking for an STL-like library that would let me do something
like the following:
tp::database data;
tp::map map1(data);
tp::list<float> list1(data);
...
tp::transaction t;
map1.start_transaction(t);
list1.start_transaction(t);
map1[5] = "hello"; // does NOT commit to container or database
list1.push_back(1.0); // does NOT commit either
t.commit(); // Finally commits to container and database.
// Without this call, t would call rollback
// in destructor.
Does anyone know of such a library ? If not, I guess
I'll have to do some writing.
If I do write it, it seems that using boost serialization
would save a lot of the work. But I've looked at it and it
seems to be missing a couple things I need. For one, it seems
to require that you serialize the entire container each
time you change one element. Perhaps I'm wrong ?
The other problem is that I don't see anything related
to transactions within the library. This may even
prevent me from using the library to implement the
actual serialization of each element, as I wouldn't be
able to gurantee that the data was NOT written. Unless
one can hook up transactional archives to boost serialization ?
Any advice or pointers would be greatly appreciated.