Boost logo

Boost Users :

From: michael mathews (muckjail_at_[hidden])
Date: 2006-11-15 17:01:14


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 <ramey_at_[hidden]> wrote:

> 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 <class N, class V> class test
> > {
> > friend class boost::serialization::access;
> > list< boost::serialization::nvp<V> > sl;
> > template<class Archive>
> > void serialize(Archive & ar, const unsigned int version)
> > {
> > ar & BOOST_SERIALIZATION_NVP(sl);
> >
> > }
> >
> > 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 <ramey_at_[hidden]> wrote:
> >
> >> 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_at_[hidden]
> >> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

 
____________________________________________________________________________________
Sponsored Link

Don't quit your job - take classes online
www.Classesusa.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net