Re: [Boost-bugs] [Boost C++ Libraries] #4394: assert in void_caster

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4394: assert in void_caster
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-14 05:22:11


#4394: assert in void_caster
------------------------------------------+---------------------------------
  Reporter: alexander@… | Owner: ramey
      Type: Bugs | Status: new
 Milestone: Boost 1.44.0 | Component: serialization
   Version: Boost 1.43.0 | Severity: Problem
Resolution: | Keywords: serialization assert
------------------------------------------+---------------------------------

Comment (by ramey):

 For now I'm going to comment out the assert.

 When I have time, I'll likely re-enable it with a way to override it.

 The problem is that the way the code is structured, you'll have multiple
 instances of some functions. The best way would be eliminate the source
 of the problem by structuring code like this:

 class base
 {
 public:
    base():a(0){};
    virtual ~base(){};

 private:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version);

 private:
    int a;
 };

 class derived: public base
 {
 public:
    derived():b(0){};
    virtual ~derived(){};

 private:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive & ar, const unsigned int version);

 private:
    int b;
 };

 In dll_derived.cpp

    template<class Archive>
    void serialize(Archive & ar, const unsigned int version){
    {
       ar & boost::serialization::base_object<base>(*this);
       ar & b;
    }

 // instantiate for archives class used:

 template derived::serialize<text_oarchive>(text_oarchive, const unsigned
 int version);
 ...

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4394#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC