I'm upgrading from boost 1.54 to the latest 1.80 and have a compilation problem with boost serialization.
I have a class A with private default constructor. Another class B has a boost::optional<A> field and also is boost::serializable.
To allow boost::serialization to create an empty instance of A during boost::serialization, I had friend class boost::serialization::access within A. It worked with boost 1.54, because that version of boost used access::construct<T>() to create an instance and so it respected my friendship declaration. In 1.80 in contrast the instance of optional<T> is initialized simply as t = T(), which obviously does not work if T has private default constructor.
Is it simply a regression by oversight, or is there some deep thought behind the breaking change? And more importantly what is the recommended way of serializing boost::optional<T>, where T has a private default constructor?
I have not found any better solution than to add the following friendship declaration to my class
A, in addition to the existingfriend class boost::serialization::accessdeclaration: