[serialization] BOOST_CLASS_IMPLEMENTATION and partial template specalization

Hello, Using BOOST_CLASS_IMPLEMENTATION there is no way to assign specific serialization implementation to any specialization of some template class. Suppose we have template class template <class Params> class LaserPointSerializationExpression { ... }; And we want that any specialization of this class should be object_serializable. Simple use of BOOST_CLASS_IMPLEMENTATION(LaserPointSerializationExpression, boost::serialization::object_serializable); will give us the following code namespace boost { namespace serialization { template <> struct implementation_level<LaserPointSerializationExpression > { typedef mpl::integral_c_tag tag; typedef mpl::int_< boost::serialization::object_serializable > type; static const int value = implementation_level::type::value; }; } } which obviously will fail to compile. The correct code is namespace boost { namespace serialization { template <class Params> struct implementation_level<asda::lpfio::LaserPointSerializationExpression<Params>
{ typedef mpl::integral_c_tag tag; typedef mpl::int_< boost::serialization::object_serializable > type; static const int value = implementation_level::type::value; }; } } But there's no macro such as BOOST_CLASS_IMPLEMENTATION to generate it. So I think there should be special version of BOOST_CLASS_IMPLEMENTATION that allows to generate implementation_level for any specialization of some template. -- ______________________________ Vyacheslav E. Andrejev System Architect, Excelsior, LLC E-mail: vandrejev@excelsior-usa.com ICQ: 7152604

This has been pointed out in the manual and way to address is described. What would such a macro look like? At some point the "convenience macros" become sufficiently complex to use that they are no more "convienient" than using just specifying the class trait directly. Robert Ramey "Vyacheslav E. Andrejev" <vandrejev@excelsior-usa.com> wrote in message news:claipr$dc6$1@sea.gmane.org...
Hello,
Using BOOST_CLASS_IMPLEMENTATION there is no way to assign specific serialization implementation to any specialization of some template class. Suppose we have template class
template <class Params> class LaserPointSerializationExpression { ... }; And we want that any specialization of this class should be object_serializable. Simple use of
BOOST_CLASS_IMPLEMENTATION(LaserPointSerializationExpression, boost::serialization::object_serializable);
will give us the following code namespace boost { namespace serialization { template <> struct implementation_level<LaserPointSerializationExpression > { typedef mpl::integral_c_tag tag; typedef mpl::int_< boost::serialization::object_serializable > type; static const int value = implementation_level::type::value; }; } } which obviously will fail to compile. The correct code is namespace boost { namespace serialization { template <class Params> struct
implementation_level<asda::lpfio::LaserPointSerializationExpression<Params>
{ typedef mpl::integral_c_tag tag; typedef mpl::int_< boost::serialization::object_serializable > type; static const int value = implementation_level::type::value; }; } } But there's no macro such as BOOST_CLASS_IMPLEMENTATION to generate it. So I think there should be special version of BOOST_CLASS_IMPLEMENTATION that allows to generate implementation_level for any specialization of some template. -- ______________________________ Vyacheslav E. Andrejev System Architect, Excelsior, LLC E-mail: vandrejev@excelsior-usa.com ICQ: 7152604
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Robert Ramey
-
Vyacheslav E. Andrejev