Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12321: save for boost::optional doesn't call save_construct_data but load calls load_construct_data
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-11-06 21:38:02
#12321: save for boost::optional doesn't call save_construct_data but load calls
load_construct_data
------------------------------------------------+--------------------------
Reporter: Oleg Burchakov <burchakov.oleg@â¦> | Owner: ramey
Type: Bugs | Status: closed
Milestone: To Be Determined | Component:
Version: Boost 1.61.0 | serialization
Resolution: fixed | Severity: Problem
| Keywords:
------------------------------------------------+--------------------------
Comment (by ramey):
I had fixed your example and checked it in. But upon doing more testing I
concluded that my "fix" would just break something else. Spending a lot
more time on this convinced me that the root cause of the problem is the
serialization of a type which out a default constructor. The library as
currently constituted really can't do that - this is not due to the usage
of "optional" it's a general limitation. Maybe if I made the library
again I might address this limitation. Or maybe I tried originally but
just accepted the limitation (without documenting it). So I'm going to
make a few changes.
a) fix it (again!) so that the test works. This will make your case fail
b) update the documentation to clarify this point. There is a workaround.
If a class has no default constructor it CAN be serialized through a
pointer while overloading save/load construct data.
c) use the boost type trait "has_default_constructor" to trap violations
of tis rule and point to an explanation.
Sorry you'll have to work around this.
Robert Ramey
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12321#comment:4> 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:20 UTC