Hello,
I
have the following struct:
struct
CUBE_INFO {
friend class boost::serialization::access;
long cube;
std::string ncube;
UINT number_dimensions;
DIMENSION_LIST dimensions;
long double number_cells;
long double
number_filled_cells;
enum STATUS { UNLOADED = 0, LOADED, CHANGED }
status;
enum TYPE { NORMAL = 0, SYSTEM,
ATTRIBUTE }
type;
friend std::istream& operator>>(
std::istream& in, CUBE_INFO& cubeInfo );
friend std::ostream&
operator<<( std::ostream& out, const CUBE_INFO& cubeInfo
);
private:
template<class Archive>
void serialize( Archive &ar, const
unsigned int version ) {
ar & cube;
ar &
dimensions;
ar & ncube;
ar &
number_cells;
ar & number_dimensions;
ar &
number_filled_cells;
ar & status;
ar &
type;
}
};
here, DIMENSION_LIST is an STL-vector of longs.
I am including
#include
<boost/serialization/vector.hpp>
#include
<boost/serialization/access.hpp>
I try to comple the
code below (MS VisualStudio 8, boost 1.34)
#include
<fstream>
#include
<boost/archive/text_oarchive.hpp>
#include
<boost/archive/text_iarchive.hpp>
#include
<string>
#include
"../Palo/Cache/AbstractCache.h"
#include "../Palo/Cache/CubeCache.h"
#include
"../Palo/Cache/CubesCache.h"
#include "../Palo/types.h"
using namespace jedox::palo;
int main(int argc, char* argv[])
{
//string filename("SerializeTest");
CUBE_INFO * const c = new
CUBE_INFO(); // add "const" here - see rationale in
documentation
std::ofstream
ofs("filename");
//std::ofstream ofs("filename"
);
// save data to
archive
{
boost::archive::text_oarchive oa( ofs );
// write class instance to archive
oa << ( c );
// archive and stream closed when destructors are
called
}
return 0;
}
The resulting error message
is:
>f:\lib\x32\include\boost\archive\detail\oserializer.hpp(567) :
error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
1>
with
1>
[
1>
x=false
1>
]
1>
f:\lib\x32\include\boost\archive\basic_text_oarchive.hpp(78) : see reference
to function template instantiation 'void
boost::archive::save<Archive,T>(Archive &,T &)' being compiled
1>
with
1>
[
1>
Archive=boost::archive::text_oarchive,
1>
T=jedox::palo::CUBE_INFO *
1>
]
regards, Oliver
_______________________________________________
Boost-users mailing
list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users