Boost logo

Boost Users :

Subject: [Boost-users] Error: final keyword using boost serialization
From: Dr. Sören Textor (s.textor_at_[hidden])
Date: 2018-11-05 06:11:34


Hello We have a little problem with the boost serialization. It's seems
to have problem with the final keyword (at least in boost v1.55). Is
there any workaround for the example oder got it fixed already in the
newest boost version? class Test final
{
public:
    Test() {}
Test(time_t t1) :m_t(t1) {}
  
protected:
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive  &ar,const unsigned int version  ) {
       ar  &m_t;
    }
  
    time_t m_t  = 12;
};

int main(int argc  ,char**argv  ){
Test t1(45); std::stringstream ofs;
boost::archive::binary_oarchive oa(ofs  );
oa  &t1;
}

  
--> compile error: is_polymorphic.hpp(46) : error C3246:
'boost::detail::is_polymorphic_imp1<T>::d2' : cannot inherit from 'Test'
as it has been declared as 'final' remarks: - the original class is a
non polymorphic POD class that is declared a final. Like in th eexample!
Best regards SirAnn



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