Boost logo

Boost Users :

Subject: Re: [Boost-users] Specifying a NVP wrapper
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2011-03-18 12:28:31


On 3/18/2011 9:30 AM, simone pilozzi wrote:
> Now I would like to allocate the xml file created with the use of this
> class in a vector, and this is the function:
>
> void
>
> getFromFile(std::vector<Contact>& contacts,constchar* file){
>
> std::ifstream ifile(file);
>
> boost::archive::xml_iarchive ia(ifile);
>
> ia >> contacts;
>
> ifile.close();
>
> }
>

You need to specify an NVP for contacts as well, like so:

ia >> boost::serialization::make_nvp( "contacts", contacts );


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