Re: [Boost-bugs] [Boost C++ Libraries] #5340: Patch to support concrete base classes becomming abstract classes

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5340: Patch to support concrete base classes becomming abstract classes
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-20 22:14:30


#5340: Patch to support concrete base classes becomming abstract classes
----------------------------------------------+-----------------------------
  Reporter: Aaron Barany <akb825@…> | Owner: ramey
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.47.0 | Severity: Showstopper
Resolution: | Keywords: serialization abstract concrete
----------------------------------------------+-----------------------------

Comment (by Aaron Barany <akb825@…>):

 I have submitted an updated patch, which resolves the compile issues with
 abstract classes. As mentioned earlier, this also removes the need for the
 base class being passed into the archive with operator &, <<, or >> to
 have serialization functions as well, as long as the instance has the
 proper functions.

 I achieved this by using the member function query trick described in my
 last post to stub out the call to the serialize member function in access.
 It was necessary for me to do it there for two reasons:
 1. The access class is the only one guaranteed to have access to the
 serialize (or save/load) functions.
 2. Just because an object doesn't have a serialize member function, it
 doesn't mean it isn't serializable, since it can have a free function. By
 putting that check in access instead of at a higher level, it will
 gracefully handle that case.

 What it will do now is throw an exception if you try to serialize an
 object that doesn't have either a free serialize function or a serialize
 member function. This can't be a compile time check, because the template
 instantiations will reference the serialize function even if it is never
 called.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5340#comment:5>
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:06 UTC