|
Boost : |
From: krempp_at_[hidden]
Date: 2001-04-17 17:15:53
> We've moved the files into CVS under the branch
> "persistence-initial". Jens and I have had some email over the
last couple
> of days, and I've written another test program, which got put in
the CVS
> branch yesterday.
Hum..
I checked out branch "persistence-initial" but I am not sure this is
actually what you are speaking about,
since the persistence_demo.cpp still throws (probleme of EOF and
file.exceptions set in definiton of save_file )
PLUS there is an obvious bug here :
template<class T, class Reader, class OutputIterator>
inline void load_sequence(Reader & reader, OutputIterator out)
{
std::size_t n;
reader.start_sequence(n);
T tmp; // BOOOUUH !
while(reader.good() && n-- > 0 && !reader.end_sequence()) {
load(reader, tmp);
*out = tmp;
++out;
}
}
when T is something like a vector<vector>, load(reader,tmp) will do
back_insertions into tmp, and thus tmp needs to be initialised at
*each iteration*, if you dont want to accumulate all elts, step
after step, making something like
[ [0] [1] [2] ]
-load->
[ [0] [0 1] [0 1 2] ]
movig 'T tmp' inside the loop is definitely needed.
> Overall, the Persistence Library seems pretty strong to me.
It's truly a nice library : very useful though pretty lightweight,
so it's fast to get used-to.
> There are a number of compiler issues, particularly with wchar_t
and FP
> types, the documentation needs a bit of updating, and more work
needs to be
> done on the XDR reader/writer, but most of these seem pretty minor
to me.
about the XDR : with my g++ (3.0-pre) I had to define
void write(std::size_t n)
void write(int n)
[ and same with laod)
because it was called with those type, but they did not match any of
the boost *least32 types.
Is it normal ?
( I dont really care about XDR, but this prevented me from compiling
test1, so I felt the need to make it run..)
-- Sam
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk