
on Wed Nov 26 2008, Kenny Riddile <kfriddile-AT-yahoo.com> wrote:
#define BOOST_CLASS_EXPORT_GUID(T, K) \ namespace \ { \ ::boost::archive::detail::guid_initializer< T > const & \ BOOST_PP_CAT(boost_serialization_guid_initializer_, __LINE__) \ = ::boost::serialization::singleton< \ ::boost::archive::detail::guid_initializer< T > \ >::get_mutable_instance().export_guid(K); \ }
with:
#define BOOST_CLASS_EXPORT_GUID(T, K) \ namespace \ { \ ::boost::archive::detail::guid_initializer< T > const & \ BOOST_PP_CAT(boost_serialization_guid_initializer_, T) \
That will only work if T is a simple identifier or number. A name like std::pair<int,int> would fail. I don't remember offhand whether class template specializations get exported by Boost.Serialization, but it seems to me that this doesn't need to be so hard in any case. You can probably make the namespace-scope variable a static member of a class template and use an explicit instantiation to generate it. If it works, there's no need for an unnamed namespace and no name clashes. -- Dave Abrahams BoostPro Computing http://www.boostpro.com