|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-12 16:54:35
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. I considered a very ugly
hack. 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.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk