|
Boost : |
From: krempp_at_[hidden]
Date: 2001-04-17 05:00:55
back in October 2000 I started a thread about saving/loading objects
à-la python's pickle,
and then discovered the boost project 'persistence' .
Now the time has come for me to save/load my nested structures (
including some tree<vector<vector> > ..), so I will definitely use
persistence.
the files in the vault are dated November 2000,
but are'nt there any private version with bits of update ?
If so, could it be uploaded somewhere in the vault, as 'alpha
version' or some other explicit name..
Anyway, at current state, when I run persistence_demo:
abort (core dumped) ./persistence_demo.exe
This is not really great,
it could scare people that tries the library so as to see whether or
not it is usable..
And it's a pity, since persistence is in fact pretty much usable.
This problem simply comes from :
void load_file(Container & cont, const std::string & filename)
{ // .....
file.exceptions(std::ios::failbit|std::ios::badbit);
And, in the reader, end_sequence calls check_for, who does
is >> std::ws;
so it tries to eat whiteSpaces until EOF, raising excepton..
I added '654321' at the end of the file, and it was enough to make
everything work nicely (since it stops is>>ws to reach EOF )
save_file :
//....
save(w, std::string(typeid(Container).name()));
save(w, cont); save(w, 654321);
But of course, other solutions are possible, like using some
try/catch blocks.
Since I am about to use persistence, I will be playing with it a bit.
Does the author Jens Maurer plan to release it for review ?
Are there some points that are missing, or absolutely need fixing
before review ?
-- Sam
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk