Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPI] Serializing a class with a string data member
From: Matthias Troyer (troyer_at_[hidden])
Date: 2009-07-23 19:26:45


On 5 Jul 2009, at 13:25, Mathieu Larose wrote:

> I've added
>
> namespace boost
> {
> namespace mpi
> {
> template<> struct is_mpi_datatype<std::string> : public
> mpl::true_ { };
> }
> }
>
> and everything works fine...

Does this really send the data? I would be very surprised if this
worked. Can you send the full code - the example you sent does not
even have a string member, and _text is undefined.

Matthias

>
>
> 2009/7/4 Mathieu Larose <mat087_at_[hidden]>:
>> Hello,
>>
>> I'm trying to register a class (named A), because it will be a
>> derived
>> class. Calling BOOST_CLASS_EXPORT(A) will generate a lot of errors
>> that look similar. Here is one of them:
>>
>> /usr/local/include/boost/mpi/datatype.hpp:184: error: no matching
>> function for call to ‘assertion_failed(mpl_::failed************
>> boost::mpi::is_mpi_datatype<std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > >::************)’
>>
>> Here is the code:
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - -
>> #include <iostream>
>> #include <boost/mpi.hpp>
>> #include <boost/archive/text_iarchive.hpp>
>> #include <boost/archive/text_oarchive.hpp>
>> #include <boost/mpi/packed_oarchive.hpp>
>> #include <boost/mpi/packed_iarchive.hpp>
>> #include <boost/serialization/export.hpp>
>> #include <boost/serialization/string.hpp>
>>
>> class A
>> {
>> friend class boost::serialization::access;
>>
>> template<class Archive>
>> void serialize(Archive & ar, const unsigned int version)
>> {
>> ar & _text;
>> }
>> };
>>
>> BOOST_CLASS_EXPORT(A); // I need to export A, because I will use
>> // abstract base pointer. A is not a derived
>> // class for simplicity here.
>>
>> int main(int argc, char * argv[])
>> {
>> return 0;
>> }
>>
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - -
>>
>> I've found that someone had the same problem (
>> http://groups.google.com/group/boost-list/msg/c9a0c133bddd783d ), but
>> no solution was found.
>>
>> What am I doing wrong?
>>
>>
>> Thanks,
>> Mathieu Larose
>>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net