Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPI] Serializing a class with a string data member
From: Mathieu Larose (mat087_at_[hidden])
Date: 2009-07-05 16:25:30


I've added

namespace boost
{
   namespace mpi
   {
      template<> struct is_mpi_datatype<std::string> : public mpl::true_ { };
   }
}

and everything works fine...

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 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