Boost logo

Boost Users :

Subject: [Boost-users] serialization::make_nvp parameters
From: Hammond, John (UK New Malden) (John.Hammond2_at_[hidden])
Date: 2009-09-08 07:16:49


Hello,

I am hoping someone could answer a question I have regarding the
make_nvp(..) function of the Serialization library.

I am attempting to serialize a number of objects within a loop, and the
name of the name-value-pair is to be assigned dynamically depending on
some values taken from within the object that is to be serialized. I am
currently performing the actions below:

my_obj = GetMyObj(..);

std::string temp = str( boost::format("x:%1% y:%2%") % _x % _y );

const char* const_temp = temp.c_str( );

ar & boost::serialization::make_nvp(const_temp, my_obj);

 

This code compiles but will cause an exception on make_nvp. As far as I
can tell, I am providing the function with the const char* that it
requires, so am very confused as to why it is not performing as
expected.

Any help with this would be greatly appreciated.

 

John Hammond

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************



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