$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [Serialization] this seems wrong
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-12-02 17:22:36
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