|
Boost Users :
|
simple
code...
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <iostream>
#include <sstream>
using namespace std;
template<typename T>
class Vector3D {
public:
T data[ 3 ];
Vector3D( double d1, double d2, double d3 ) {
data[ 0 ] = d1;
data[ 1 ] = d2;
data[ 2 ] = d3;
}
Vector3D( void ) {
data[ 0 ] = 0;
data[ 1 ] = 0;
data[ 2 ] = 0;
}
template<typename Archive>
void serialize( Archive& ar, unsigned int ) { ar & data; }
};
int main( int argc, char* argv[] )
{
stringstream ss;
Vector3D<double> v1( 10, 20, 30 );
{
boost::archive::text_oarchive oa( ss );
oa << v1;
}
Vector3D<double> v2;
assert( v1.data[0] != v2.data[0] );
{
boost::archive::text_iarchive ia( ss );
ia >> v2;
}
assert( v1.data[0] == v2.data[0] );
return 0;
}
on g++ this works fine (gcc 3.4.4 and gcc 4.0.1)
on intel 10.0.023 and 9.??, i get...
prompt> icc -I{boost 1.36 header dir} simple.cc
/usr/projects/packages/include/boost/archive/detail/oserializer.hpp(536):
error: nontype "boost::static_warning_impl<<unnamed>>::type
[with
<unnamed>=(bool)boost::archive::check_tracking<T>::value]"
is not a type name
BOOST_STATIC_WARNING(check_tracking<T>::value);
^
detected during:
instantiation of "void
boost::archive::detail::common_oarchive<Archive>::save_override(T
&, int) [with Archive=boost::archive::text_oarchive,
T=Vector3D<double>]" at line 75 of
"/usr/projects/packages/include/boost/archive/basic_text_oarchive.hpp"
instantiation of "void
boost::archive::basic_text_oarchive<Archive>::save_override(T
&, int) [with Archive=boost::archive::text_oarchive,
T=Vector3D<double>]" at line 64 of
"/usr/projects/packages/include/boost/archive/detail/interface_oarchive.hpp"
instantiation of "Archive
&boost::archive::detail::interface_oarchive<Archive>::operator<<(T
&) [with Archive=boost::archive::text_oarchive,
T=Vector3D<double>]" at line 33 of "simple.cc"
compilation aborted for simple.cc (code 2)
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