boost serialization of std::pair

Hi, Is there any way of customizing the element names given to serialization of std::pair via xml_oarchive. Im think of something like the|||BOOST_SERIALIZATION_NVP mechanism. In particular Im looking to serialize std::map with custom elemnet names to replace '<first>' and '<second>' Thanks Andy |

Am 18.03.2013 12:46, schrieb Andrew Smith:
Hi,
Is there any way of customizing the element names given to serialization of std::pair via xml_oarchive. Im think of something like the|||BOOST_SERIALIZATION_NVP mechanism.
In particular Im looking to serialize std::map with custom elemnet names to replace '<first>' and '<second>'
depending on whether you want your container to always be serialized
this way, or just for your specific file type, you could derive from
xml_oarchive and implement a save_override function - see the Archive
concept documentation, or you could implement a serialize() function for
your specific container or the type holding the container.
the latter case would either look like
---
void serialize(Archive &ar,std::map

Andrew Smith wrote:
Hi,
Is there any way of customizing the element names given to serialization of std::pair via xml_oarchive. Im think of something like the BOOST_SERIALIZATION_NVP mechanism.
In particular Im looking to serialize std::map with custom elemnet names to replace '<first>' and '<second>'
Thanks
Andy
there is no reason why you can't just copy the std::map serialization and replace it with your own. Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Andrew Smith
-
Robert Ramey
-
Stefan Strasser