この例http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/serialization.html#constructorsに従おうとしていますが、エラーが発生し続けます。例に従って、プライベート変数にアクセスしようとするとエラーが発生します(十分に公平です)。
bs.cpp:10: error: ‘const int my_class::m_attribute’ is private
しかし、save_construct_dataを友達として追加すると、あいまいなエラーが発生します。
/usr/include/boost/serialization/serialization.hpp:148: error: call of overloaded ‘save_construct_data(boost::archive::text_oarchive&, const my_class*&, const boost::serialization::version_type&)’ is ambiguous
/usr/include/boost/serialization/serialization.hpp:83: note: candidates are: void boost::serialization::save_construct_data(Archive&, const T*, unsigned int) [with Archive = boost::archive::text_oarchive, T = my_class]
bs.cpp:10: note: void boost::serialization::save_construct_data(Archive&, const my_class*, unsigned int) [with Archive = boost::archive::text_oarchive]
bs.cpp:29: note: void boost::serialization::save_construct_data(Archive&, const my_class*, unsigned int) [with Archive = boost::archive::text_oarchive]
関数定義をfriend宣言に移動することはできますが、それは醜いです。
次に何を試してみるべきですか?
ありがとう、ジェイエン