Ticket #9208: boostMPIpatch.diff

File boostMPIpatch.diff, 1.9 KB (added by Steve Nolen <drnuke@…>, 9 years ago)
  • detail/packed_oprimitive.hpp

     
    2020#include <boost/assert.hpp>
    2121#include <vector>
    2222#include <boost/mpi/allocator.hpp>
     23//#include <boost/numeric/conversion/cast.hpp> // provides boost::numeric_cast
    2324
    2425namespace boost { namespace mpi {
    2526
     
    8182    {
    8283      unsigned int l = static_cast<unsigned int>(s.size());
    8384      save(l);
    84       if (l)
    85         save_impl(s.data(),get_mpi_datatype(CharType()),s.size());
     85      save_impl(s.data(),get_mpi_datatype(CharType()),s.size());
    8686    }
    8787
     88    void save( const boost::archive::version_type& v )
     89    {
     90        unsigned position = buffer_.size();
     91        buffer_.resize( position+1 );
     92        // Require conversion to a 1-byte int
     93        // uint8_t compactV = boost::numeric_cast<uint8_t>( v ); // type safe
     94        uint8_t compactV = v; // not really safe!
     95        buffer_[ position ] = compactV;
     96    }
     97
    8898private:
    8999
    90100    void save_impl(void const * p, MPI_Datatype t, int l)
  • detail/packed_iprimitive.hpp

     
    9494        load(l);
    9595        s.resize(l);
    9696        // note breaking a rule here - could be a problem on some platform
    97         if (l)
    98           load_impl(const_cast<CharType *>(s.data()),
    99                     get_mpi_datatype(CharType()),l);
     97        load_impl(const_cast<CharType *>(s.data()),get_mpi_datatype(CharType()),l);
    10098    }
    10199
     100    void load( boost::archive::version_type& v )
     101    {
     102        v = static_cast<boost::archive::version_type>( buffer_[ position ] );
     103        ++position;
     104    }
     105
    102106private:
    103107
    104108    void load_impl(void * p, MPI_Datatype t, int l)