Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-26 16:45:59


try replacing

    template<class Archive, class T>
      inline void save(Archive& ar, derived<T>& obj, const unsigned int version)
    {
    ...

with

    template<class Archive, class T>
      inline void save(Archive& ar, const derived<T>& obj, const unsigned int version) // note const !!!
    {
    ...

Robert Ramey
  "Pyush Agrawal" <pyush.agrawal_at_[hidden]> wrote in message news:f7a7f9d105092611174db1c70_at_mail.gmail.com...
  Hi,
    I am relatively a new to Boost serialization classes. I am trying to serialize a derived template class.

  template<class T> class base {};
  tempate<class T> class derived : public base<T> {};

  I am trying to serialize 'derived' and have tried many different things. I am unable to serialize the inherited template classes.
  For some reason the code calls
  (1) 'derived::Serialize'
  (2) 'base::Save'
  and never executes 'derived:: Save' and doesnot serialize the 'derived' object properly.

  I am attaching the source code (SerializeTemplates.cpp) and the output(output.txt) of the program.
  I am using MSVC7.1, debug mode, Boost 1.33, Spirit 1.8
  It will be great, if somebody could point out what I am doing wrong.
  Thanks,
  Pyush

------------------------------------------------------------------------------

  _______________________________________________
  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