Hello,
I have a problem with serializing smart_ptrs. I have tried both the
boost::scoped_ptr and the boost::shared_ptr but I get always the same error:
Boost1-33\include\boost-1_33\boost\archive\detail\oserializer.hpp(566):
error C2027: Use of undefined type "boost::STATIC_ASSERTION_FAILURE<x>"
with
[
x=false
]
My example program:
#include
#include
#include
#include
struct Foo
{
int i;
Foo( int j )
: i( j )
{
}
template< class T >
void serialize( T& ar, const unsigned int ver )
{
ar & i;
}
};
struct Test
{
boost::shared_ptr< Foo > t1;
boost::shared_ptr< Foo > t2;
Test()
: t1( new Foo( 3 ) ), t2( t1 )
{
}
template< class Ar >
void save( Ar& ar, const unsigned int ver )
{
ar << t1;
ar << t2;
}
template< class Ar >
void load( Ar& ar, const unsigned int ver )
{
ar >> t1;
ar >> t2;
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
};
int main( int argc, char* argv[] )
{
Test t;
std::ofstream ofs( "test.txt" );
boost::archive::text_oarchive out( ofs );
out << t;
}
I hope someone can help me (google and the documentation couldn't :()
Sascha Friedmann