Boost logo

Boost :

Subject: Re: [boost] [Serialization] this seems wrong
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2008-12-02 18:15:49


Steven Watanabe wrote:
> AMDG
>
> Michael Marcin wrote:
>> I don't know about getting rid of the unnamed namespace but
>> essentially we just need a unique name per type in a translation
>> unit.. so how about:
>>
>> #define BOOST_CLASS_EXPORT_GUID(T, K) \
>> namespace \
>> { \
>> template< typename U > \
>> class init_guid \
>> { \
>> static ::boost::archive::detail::guid_initializer<U> const & \
>> guid_initializer_; \
>> }; \
>> template<> ::boost::archive::detail::guid_initializer<T> const & \
>> init_guid<T>::guid_initializer_ = \
>> ::boost::serialization::singleton< \
>> ::boost::archive::detail::guid_initializer<T> \
>> >::get_mutable_instance().export_guid(K); \
>> }
>
> With a little fiddling, I think that this might be made to work.
>
> #define BOOST_CLASS_EXPORT_GUID(T, K) \
> namespace \
> { \
> template< typename U > \
> class init_guid; \
> template<> \
> class init_guid<T> \
> { \
> static ::boost::archive::detail::guid_initializer<T> const & \
> guid_initializer_; \
> }; \
> ::boost::archive::detail::guid_initializer<T> const & \
> init_guid<T>::guid_initializer_ = \
> ::boost::serialization::singleton< \
> ::boost::archive::detail::guid_initializer<T> \
> >::get_mutable_instance().export_guid(K); \
> }
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
That appears to work for me! Of course I've only tested it in my
particular use-case. Can this fix be committed to trunk so that it's
tested more thoroughly, and maybe included in a future release?


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