Hello, I have 2 questions regarding the Serialization library:
=========================
I have a function that I am using to load a serialized class, called "Configuration". A particular line in the function produces a warning message. Should I be worried about this warning?
The function is below, with a comment denoting the warning-producing line.
void Configuration::Save(const string& Name)
{
ofstream Out(Name.c_str());
if(Out.fail())
throw runtime_error("Error: unable to save configuration file.");
boost::archive::text_oarchive Archiver(Out);
Archiver << *this; // This line produces the warning.
}
The warning is:
C4308: negative integral constant converted to unsigned type ... error is from file: \boost\mpl\print.hpp line: 51
=========================
In a separate question, I'm wondering why this code compiles:
template<class Archive> void save(Archive& ar, const boost::asio::ip::udp::endpoint& endpoint, unsigned int version)
{
unsigned short Port = endpoint.port();
ar << endpoint.address().to_string();
ar << Port;
}
But this code does not compile:
template<class Archive> void save(Archive& ar, const boost::asio::ip::udp::endpoint& endpoint, unsigned int version)
{
ar << endpoint.address().to_string();
ar << endpoint.port();
}
The only difference is endpoint.port() is stored in a seperate unsigned short.
=========================
Any help is much appreciated!
-- Dylan