
Can I get a little help please? I don't understand what's wrong with this, can anyone help? I have ublas_ser.hpp and a start at a test test_ublas_ser.cpp, but I get this error: [...] /usr/include/boost/archive/detail/oserializer.hpp:107: error: incomplete type ‘boost::serialization::extended_type_info_null<boost::numeric::ublas::vector<int, boost::numeric::ublas::unbounded_array<int, std::allocator<int> > > >’ used in nested name specifier /usr/include/boost/archive/detail/oserializer.hpp: In member function ‘bool boost::archive::detail::oserializer<Archive, T>::is_polymorphic() const [with Archive = boost::archive::binary_oarchive, T = boost::numeric::ublas::vector<int, boost::numeric::ublas::unbounded_array<int, std::allocator<int> > >]’: #include <boost/serialization/split_free.hpp> #include <boost/serialization/nvp.hpp> #include <boost/serialization/level.hpp> #include <boost/serialization/tracking.hpp> #include <boost/mpl/int.hpp> #include <complex> #include <boost/numeric/ublas/vector.hpp> namespace boost { namespace serialization { template<class T> struct implementation_level<std::complex<T> > { typedef mpl::integral_c_tag tag; // typedef mpl::int_<primitive_type> type; typedef mpl::int_<object_serializable> type; BOOST_STATIC_CONSTANT( int, value = implementation_level::type::value ); }; template<class T> struct tracking_level<std::complex<T> > { typedef mpl::integral_c_tag tag; typedef mpl::int_<track_never> type; BOOST_STATIC_CONSTANT( int, value = tracking_level::type::value ); }; } } namespace boost { namespace serialization { template<class Archive, class T> inline void serialize (Archive &ar, std::complex<T>& z, const unsigned int file_version) { ar & boost::serialization::make_nvp ("real", real(z)); ar & boost::serialization::make_nvp ("imag", imag(z)); // ar & real(z); // ar & imag(z); } } } namespace boost { namespace serialization { template<class T> struct implementation_level<boost::numeric::ublas::vector<T> > { typedef mpl::integral_c_tag tag; // typedef mpl::int_<primitive_type> type; typedef mpl::int_<object_serializable> type; BOOST_STATIC_CONSTANT( int, value = implementation_level::type::value ); }; } } template<class Archive, class U> inline void save (Archive &ar, const boost::numeric::ublas::vector<U> &v, const unsigned int) { unsigned int count = v.size(); ar << BOOST_SERIALIZATION_NVP (count); typename boost::numeric::ublas::vector<U>::const_iterator it = v.begin(); while (count-- > 0) { ar << boost::serialization::make_nvp ("item", *it++); } } template<class Archive, class U> inline void load (Archive &ar, boost::numeric::ublas::vector<U> &v, const unsigned int) { unsigned int count; ar >> BOOST_SERIALIZATION_NVP (count); v.resize (count); typename boost::numeric::ublas::vector<U>::iterator it = v.begin(); while (count-- > 0) { ar >> boost::serialization::make_nvp ("item", *it++); } } namespace boost { namespace serialization { template<class Archive, class U> inline void serialize (Archive &ar, boost::numeric::ublas::vector<U>& v, const unsigned int file_version) { boost::serialization::split_free (ar, v, file_version); } } } #include "ublas_ser.hpp" #include <boost/test/minimal.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> #include <sstream> #include <string> namespace ublas = boost::numeric::ublas; template<typename V> std::string Saveit (V const& v) { std::ostringstream os; boost::archive::binary_oarchive oa (os); oa << v; return os.str(); } int test_main( int, char *[] ) { using namespace boost::serialization; ublas::vector<int> a (10); for (int i = 0; i < a.size(); ++i) a[i] = i; std::ostringstream os; boost::archive::binary_oarchive oa (os); oa << const_cast<const ublas::vector<int>&> (a); // std::string s = Saveit (a); }