|
Boost : |
From: Matthias Troyer (troyer_at_[hidden])
Date: 2006-02-12 09:00:19
On Feb 12, 2006, at 2:59 AM, Peter Dimov wrote:
> David Abrahams wrote:
>
>>> Consider an archive where unsigned int and unsigned long have a
>>> different internal representation. When a value of a size_t type is
>>> written on platform A, where size_t == unsigned int, platform B,
>>> where size_t == unsigned long, won't be able to read the file.
>>
>> Sure, but I don't see what that has to do with the ambiguity in
>> overload resolution you're pointing at above.
>
> Not ambiguity, just that different overloads will be called on
> different
> platforms.
>
>> I don't think anyone is suggesting that we use size_t; int has a
>> similar problem, after all. I thought Matthias was using a
>> variable-length representation, but on inspection it looks like he's
>> just using a "strong typedef" around std::size_t, which should work
>> adequately for the purposes we're discussing.
>
> A strong typedef should work, if all archives implement its
> serialization.
As far as I understand there is a default implementation of
serialization for
strong typedefs, which just serializes the underlying type. Only
archives needing
different behavior will have to implement its serialization.
Matthias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk