Index: storage.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/numeric/ublas/storage.hpp,v retrieving revision 1.75 diff -b -d -u -r1.75 storage.hpp --- storage.hpp 21 Jun 2006 18:17:53 -0000 1.75 +++ storage.hpp 6 Jan 2007 16:06:46 -0000 @@ -22,6 +22,11 @@ #include #endif +#include +#include +#include +#include + #include #include @@ -90,6 +95,7 @@ } BOOST_UBLAS_INLINE unbounded_array (const unbounded_array &c): + storage_array >(), alloc_ (c.alloc_), size_ (c.size_) { if (size_) { data_ = alloc_.allocate (size_); @@ -109,6 +115,26 @@ } } + // Serialization + private: + friend class boost::serialization::access; + template + void save(Archive & ar, const unsigned int version) const + { + serialization::collection_size_type s(size_); + ar & serialization::make_nvp("size",s); + ar & serialization::make_array(data_, size_); + } + template + void load(Archive & ar, const unsigned int version) + { + serialization::collection_size_type new_size; + ar & new_size; + resize_internal(new_size, value_type(), false); + ar & serialization::make_array(data_, size_); + } + BOOST_SERIALIZATION_SPLIT_MEMBER() + // Resizing private: BOOST_UBLAS_INLINE @@ -433,6 +459,30 @@ } private: + // Serialization + friend class boost::serialization::access; + + + friend class boost::serialization::access; + template + void save(Archive & ar, const unsigned int version) const + { + serialization::collection_size_type s(size_); + ar & serialization::make_nvp("size",s); + ar & serialization::make_array(data_, size_); + } + template + void load(Archive & ar, const unsigned int version) + { + serialization::collection_size_type new_size; + ar & new_size; + if (new_size > N) bad_size("too large size in bounded_array::load()\n").raise(); + resize(new_size); + ar & serialization::make_array(data_, size_); + } + BOOST_SERIALIZATION_SPLIT_MEMBER() + + private: size_type size_; BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [N]; };