Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-09-12 20:29:10


"Robert Ramey" <ramey_at_[hidden]> writes:

> David Abrahams wrote:
>> Overload serialize in the namespace of your class.
>>
>> Then write another, possibly uglier, recommendation that works on all
>> supported compilers. If you have to use macros, that's fine. E.g.,
>>
>>
>> // somewhere in the serialization library
>> #if BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
>> # define BOOST_SERIALIZE(namespace) serialize
>> #else
>> # define BOOST_SERIALIZE(namespace) namespace::serialize
>> #endif
>>
>> // user code
>> namespace my { namespace ns
>> {
>> class my_class { ... };
>>
>> template <class A>
>> void serialize(A&, my_class); // declaration (unused in non-ADL
>> case) }}
>>
>> // definition
>> template <class Archive>
>> void BOOST_SERIALIZE(my::ns)(Archive& ar, ny::ns::my_class& x)
>> {
>> ...
>> }
>
> That sounds like what I did for version 1.32.

Is it equivalent to what you did, or does it just sound reminiscent?

> I considered a very ugly hack.
              ^
              "it?"

> I don't think I was the only person that felt this way. I resolved
> to fix it in the next version - and here we are. oh well.

Surely you don't think the recommendation I'm suggesting for
conforming compilers is an ugly hack?

IMO it doesn't matter much how ugly the portable-to-broken-compilers
workaround is, as long as it's legit for the conforming ones and
doesn't induce maintenance problems.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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