[Serialization] xml_archive + templates = :-(
Hi, Quite sensibly, xml_archive seems to fail with archive errors when class_name contains xml characters (like <) which are quite common in templates. For example, in my tests: BOOST_EXPORT_CLASS(Something<T>); // fails when deserializing because of parse error. I fix it by doing: BOOST_EXPORT_CLASS_GUID(Something<T>,"Something_T"); // works \o/ Now, do you suppose xml_archive could be smart enough to convert < to < and similarly for other prohibited characters when serializing? Even if not, is there something I can do in 1.33.1 that would make it not so redundant? Thanks, Sohail
The macro can't work with templates even if the xml syntax issue were resolved. One has to use BOOST_EXPORT_CLASS_GUID(Something<MyThing>,"Something_MyThing"); // works \o/ This is because the GUID has to be different for each class. They can't ll be "Something_T" Robert Ramey Sohail Somani wrote:
Hi,
Quite sensibly, xml_archive seems to fail with archive errors when class_name contains xml characters (like <) which are quite common in templates. For example, in my tests:
BOOST_EXPORT_CLASS(Something<T>); // fails when deserializing because of parse error.
I fix it by doing:
BOOST_EXPORT_CLASS_GUID(Something<T>,"Something_T"); // works \o/
Now, do you suppose xml_archive could be smart enough to convert < to < and similarly for other prohibited characters when serializing? Even if not, is there something I can do in 1.33.1 that would make it not so redundant?
Thanks,
Sohail
Oh I didn't mean to suggest that was within a template. Just would be nice to be able to use BOOST_CLASS_EXPORT for instantiated class templates as well. /me remembers not to use T in a non-template context again -----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Robert Ramey Sent: Fri 4/27/2007 6:51 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Serialization] xml_archive + templates = :-( The macro can't work with templates even if the xml syntax issue were resolved. One has to use BOOST_EXPORT_CLASS_GUID(Something<MyThing>,"Something_MyThing"); // works \o/ This is because the GUID has to be different for each class. They can't ll be "Something_T" Robert Ramey Sohail Somani wrote:
Hi,
Quite sensibly, xml_archive seems to fail with archive errors when class_name contains xml characters (like <) which are quite common in templates. For example, in my tests:
BOOST_EXPORT_CLASS(Something<T>); // fails when deserializing because of parse error.
I fix it by doing:
BOOST_EXPORT_CLASS_GUID(Something<T>,"Something_T"); // works \o/
Now, do you suppose xml_archive could be smart enough to convert < to < and similarly for other prohibited characters when serializing? Even if not, is there something I can do in 1.33.1 that would make it not so redundant?
Thanks,
Sohail
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Robert Ramey
-
Sohail Somani