Index: detail/packed_oprimitive.hpp =================================================================== --- detail/packed_oprimitive.hpp (revision 86196) +++ detail/packed_oprimitive.hpp (working copy) @@ -20,6 +20,7 @@ #include #include #include +//#include // provides boost::numeric_cast namespace boost { namespace mpi { @@ -81,10 +82,19 @@ { unsigned int l = static_cast(s.size()); save(l); - if (l) - save_impl(s.data(),get_mpi_datatype(CharType()),s.size()); + save_impl(s.data(),get_mpi_datatype(CharType()),s.size()); } + void save( const boost::archive::version_type& v ) + { + unsigned position = buffer_.size(); + buffer_.resize( position+1 ); + // Require conversion to a 1-byte int + // uint8_t compactV = boost::numeric_cast( v ); // type safe + uint8_t compactV = v; // not really safe! + buffer_[ position ] = compactV; + } + private: void save_impl(void const * p, MPI_Datatype t, int l) Index: detail/packed_iprimitive.hpp =================================================================== --- detail/packed_iprimitive.hpp (revision 86196) +++ detail/packed_iprimitive.hpp (working copy) @@ -94,11 +94,15 @@ load(l); s.resize(l); // note breaking a rule here - could be a problem on some platform - if (l) - load_impl(const_cast(s.data()), - get_mpi_datatype(CharType()),l); + load_impl(const_cast(s.data()),get_mpi_datatype(CharType()),l); } + void load( boost::archive::version_type& v ) + { + v = static_cast( buffer_[ position ] ); + ++position; + } + private: void load_impl(void * p, MPI_Datatype t, int l)