|
Boost Users : |
Subject: [Boost-users] [Serialization]
From: Dylan Klomparens (dylan.klomparens_at_[hidden])
Date: 2009-11-05 18:01:03
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
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