Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-11-26 02:23:18


On Tuesday, November 26, 2002, at 03:01 AM, Robert Ramey wrote:

> Date: Mon, 25 Nov 2002 10:41:17 +0100
> From: Matthias Troyer <troyer_at_[hidden]>
>
>>> I guess this should be changed to:
>>> #ifdef BOOST_HAS_MS_INT64
>>> virtual basic_iarchive & operator>>(int64_t & _Val) = 0;
>>> virtual basic_iarchive & operator>>(uint64_t & _Val) = 0;
>>> #endif
>>> #ifdef BOOST_HAS_LONG_LONG
>>> virtual basic_iarchive & operator>>(long long & _Val) = 0;
>>> #endif
>
>> This sounds better. Thanks.
>
> whoops, that doesn't work either - this will take some work to address.
>
>
>>> why can't this be handled using
>>>
>>> basic_oarchive::write_binary(void *p, size_t count)
>
>> This does not allow type-specific transformation (e.g. change of byte
>> order) to be performed. Thus we neeed one such function for each
>> primitive type.
>
> I fail to see the problem. If you want superfast i/o with only once
> virtual function call use
>
> basic_oarchive::write_binary(void *p, size_t count)
>
> If you want each array item handled individually use
>
> ar << t
>
> Note that if t is a fundamental type, all serialization machinery
> is effectively bypassed. So the only overhead is one vtable
> indirection which should be small compared to doing something
> like changing bigendian to little endien

No, Robert, one virtual function call can be much slower than changing
byte order when copying integers.

Matthias


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