Ticket #3394: boost-strings.diff

File boost-strings.diff, 1.7 KB (added by boost@…, 13 years ago)

proposed fix

  • boost/mpi/detail/packed_iprimitive.hpp

    diff -Naurd boost/boost/mpi/detail/packed_iprimitive.hpp boost-strings/boost/mpi/detail/packed_iprimitive.hpp
    old new  
    8686        load_impl(&t, get_mpi_datatype(t), 1);
    8787    }
    8888
    89     void load( std::string & s)
     89    template<typename char_type>
     90    void load( std::basic_string<char_type> & s)
    9091    {
    9192       unsigned int l;
    9293        load(l);
     
    9697        #endif
    9798        s.resize(l);
    9899        // note breaking a rule here - could be a problem on some platform
    99         load_impl(const_cast<char *>(s.data()),MPI_CHAR,l);
    100     }
     100        load_impl(const_cast<char_type *>(s.data()),MPI_CHAR,l*sizeof(char_type));
     101        }
    101102
    102103private:
    103104
    104105    void load_impl(void * p, MPI_Datatype t, int l)
    105     {
     106        {
    106107        BOOST_MPI_CHECK_RESULT(MPI_Unpack,
    107108        (const_cast<char*>(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position, p, l, t, comm));
    108     }
     109        }
    109110
    110111        buffer_type & buffer_;
    111112        mutable std::size_t size_;
  • boost/mpi/detail/packed_oprimitive.hpp

    diff -Naurd boost/boost/mpi/detail/packed_oprimitive.hpp boost-strings/boost/mpi/detail/packed_oprimitive.hpp
    old new  
    7777        save_impl(&t, get_mpi_datatype<T>(t), 1);
    7878    }
    7979
    80     void save(const std::string &s)
    81     {
     80        template<typename char_type>
     81        void save(const std::basic_string<char_type> &s)
     82        {
    8283      unsigned int l = static_cast<unsigned int>(s.size());
    8384      save(l);
    84       save_impl(s.data(),MPI_CHAR,s.size());
    85     }
     85      save_impl(s.data(),MPI_CHAR,s.size()*sizeof(char_type));
     86        }
    8687
    8788private:
    8889