On Monday, November 25, 2002, at 05:22 AM, Robert Ramey wrote:

Date: Sun, 24 Nov 2002 20:39:03 +0100
From: Matthias Troyer <[EMAIL PROTECTED]>

you seem to have misunderstood that: a function

void basic_oarchive::write_array(double* p, std::size_t n)

will work for ALL contiguous data: C-arrays, std::vector, ublas and MTL
arrays, and so on
Hmmm - what I don't understand is how this would be different that calling

void basic_oarchive::write_array(void* p, size_t count)

which has been in the library from the very beginning.

So you can just as well wite

class MyClass
{
double d[100000];
void save(basic_oarchive &ar)
{
write_binary(d, sizeof(d));
}
...
};

Incidently, this would work for any kind of archive - not just the
binary ones.
The difference is that with this approach you cannot do any transformation on the type (e.g. transforming the byte order of integers into a platform independent format, or converting floating point formats). For this reason we need separate write and read functions for each of the fundamental types.

Matthias

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to