Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-04-21 01:08:03


This is expained in the rationale section of the documentation.

Robert Ramey

Hansi Hansi wrote:
> I don't know if this is the right forum for that...
>
> In the following example I get the compile error (VS2005) Error 1
> error C2027: use of undefined type
> 'boost::STATIC_ASSERTION_FAILURE<x>'
> c:\boost_1_33_1\boost\archive\detail\oserializer.hpp 567 Can anyone
> say me why? If I define const gps_position it works, otherwhise it
> fails
>
>
>
> class gps_position
> {
> private:
> friend class boost::serialization::access;
> // When the class Archive corresponds to an output archive, the
> // & operator is defined similar to <<. Likewise, when the class
> Archive // is a type of input archive the & operator is defined
> similar to >>.
> template<class Archive>
> void serialize(Archive & ar, const unsigned int version)
> {
> ar & degrees;
> ar & minutes;
> ar & seconds;
> }
> int degrees;
> int minutes;
> float seconds;
> public:
> gps_position(){};
> gps_position(int d, int m, float s) :
> degrees(d), minutes(m), seconds(s)
> {}
> };
>
>
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> gps_position newVector;
> const gps_position* poldVector = new gps_position();
>
> {
> std::ofstream ofs("test.dat");
> boost::archive::text_oarchive oa(ofs);
> oa << poldVector;
> }
>
> {
> std::ifstream ifs("test.dat", std::ios_base::binary);
> boost::archive::text_iarchive ia(ifs);
> ia >> newVector; // read data
> }
>
> return 0;
>
>
> }
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


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