and xml_archive requires that ALL elements have a name. So
list< boost::serialization::nvp<V> > sl; ... ar & sl; ...
would have to be changed to:
list< boost::serialization::nvp<V> > sl; ... ar & BOOST_SERIALIZATION_NVP(sl); ...
which would be OK... But there is one thing you might not like.
You'll see an extra level tags added by the standard serialization
of std::list. These tags have the name "item" - because at
that level, there is not way to know what name they should have.
I'm guessing this would bother you. In that case you should
use your own enhanced version of serialization of list items.
The first thing I would try would be to make
template Correct I have a list of NVP's. But that is what I need. The idea is
to have a list of name value pairs where the name is used to generate
the tag and the value is the value to save. Isn't that how a NVP gets
serialized to an xml archive? I have also tried
list< boost::serialization::nvp<V> > sl;
...
ar & sl;
...
which I thought would work since the elements of the list are NVP's
It also gets caught in the trap. michael --- Robert Ramey This isn't an NVP - its a list of NVPs Try
list<V> sl;
...
ar & BOOST_SERIALIZATION_NVP(sl); Robert Ramey michael mathews wrote: Well I thought it should and I suspect that I am doing something
silly but this is basically the class I have: template } public:
{
...
}
and it gets caught in the compile trap template<class T>
void save_override(T & t, BOOST_PFTO int)
{
// If your program fails to compile here, its most likely due
to
// not specifying an nvp wrapper around the variable to
// be serialized.
BOOST_STATIC_ASSERT(0 == sizeof(T));
}
I thought that a nvp should be serializable automatically.
Ideas?
Thanks in advance
michael --- Robert Ramey Doesn't it already do this? Robert Ramey michael mathews wrote: Hi All, I have a class that contains a list of name value pairs . I would
like the serialization to use the names for the tag names in the
xml archive. Is there a way to do this or do I need to write my
own custom archive? Thanks in advance Michael __________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com _______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users ____________________________________________________________________________________ Sponsored Link Online degrees - find the right program to advance your career.
Www.nextag.com _______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users ____________________________________________________________________________________
Sponsored Link Don't quit your job - take classes online
www.Classesusa.com