Re: [Boost-bugs] [Boost C++ Libraries] #4044: reset_object_address with library-created objects

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4044: reset_object_address with library-created objects
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-27 03:46:46


#4044: reset_object_address with library-created objects
-------------------------------------------------+--------------------------
 Reporter: Richard Hazlewood | Owner: ramey
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: serialization
  Version: Boost 1.42.0 | Severity: Problem
 Keywords: reset_object_address heap allocated |
-------------------------------------------------+--------------------------

Comment(by ramey):

 What I think you want is a variable functor. This has nothing to do with
 seriaization but I'll address it anyway.

 a) Method one.
    1) Derive all functors from a common base class.
    2) Make the base class virtual by adding one virtual function
    3) Good idea to make it abstract as well.
    4) maybe you want to make operator()() virtual as well.
    4) serialize as one would any base class pointer - using EXPORT or
 register_type

 b) Method two.
    1) Use a boost::variant which can hold any one of all the types of
 functors you want
       to use.
    2) serialize an instance of the variant. This is already in the
 library.

 The crux of the issue is that you really want to to serialize a type
 rather than a piece of data. Either of the above two methods will do the
 job.

 This is the best I can guess as to what you want to do give the
 information I have.

 Robert Ramey



 all the functor derived from a common base class

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4044#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:02 UTC