That is not a greate problem.
The problems start then...
The reason of the problem can be follow:
one of the operator [](int Index) has two versions, which have only one difference:
const OTCValue& and OTCValue&.
Maybe the compiler cannot choose the necessary.
But now I have another problem:
I have such a class, which shouldn't be saved normally (OTCData).
The reason for this: this class has a member, which should be rerialized via string, more then that, it cannot be copied (OTCDataID and OTCDataHeaderID).
So I've tried to do following:
#include
Is it possible that m_value is uninitialized? It is a known problem that many compilers can can write uninitialized floating/double values to a text stream and then cannot read them. This topic is currently being discussd on the developer's list - as it arises all the time.
Take a look a test_serial.txt with a text editor. What does it look like?
Robert Ramey
tkachenkok@gmx.de wrote:
I've tried to write my first application with Boost.Serialization library.
Here is the part of code, where the boost::text_iarchive throws an exception "boost::archive::archive_exception" "what(): stream error":
[code] enum Origin { UNKNOWN=0, MEASURED, AVERAGE };
class OTCValue { friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & m_value; ar & m_orig; } double m_value; Origin m_orig; ... }; ... const OTCValue val1=(*loaded.second.begin())->get_row(0)[0]; { std::ofstream ofs("test_serial.txt"); boost::archive::text_oarchive oa(ofs); oa << val1; } OTCValue val; { std::ifstream ifs("test_serial.txt"); boost::archive::text_iarchive ia(ifs); ia >> val; // here is this exceptions thrown } ... [/code]
And here is a little bit different code, which works great:
[code] enum Origin { UNKNOWN=0, MEASURED, AVERAGE };
class OTCValue { friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & m_value; ar & m_orig; } double m_value; Origin m_orig; ... }; ... const OTCValue val1(5.5, MEASURED); { std::ofstream ofs("test_serial.txt"); boost::archive::text_oarchive oa(ofs); oa << val1; } OTCValue val; { std::ifstream ifs("test_serial.txt"); boost::archive::text_iarchive ia(ifs); ia >> val; } ... [/code]
What is the problem? The construction (*loaded.second.begin())->get_row(0)[0] returns an OTCValue .
I have compiled the boost-1.33.1 from the sources (www.boost.org). The project I've made is under KDevelop 3.2.2 (initially consol "Hello World" application)
Operating System: SuSe Linux 10.0 Compiler: gcc version 4.0.2
I hope, that I've gave enouph information. If not, ask what aou need, you are welcome.
Best regards, and thanks to all!
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit! "Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl