0
如何序列化類型爲electric_potential和double的映射? ? 在我的代碼我已經把這些標題:錯誤C2039:'serialize':不是'boost :: units :: quantity <boost :: units :: si :: electric_potential,double>'的成員'
#include <boost/serialization/complex.hpp>
#include <boost/serialization/map.hpp>
#include <boost/units/physical_dimensions/electric_potential.hpp>
template<class Archive, class T>
static void serialize(Archive & ar, T & t, const unsigned int file_version){
t.serialize(ar, file_version);
}
extern "C++" class Data_substation_AC2 : public Data_OG
{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Data_OG);
ar & BOOST_SERIALIZATION_NVP(_primary_voltage);
ar & BOOST_SERIALIZATION_NVP(_secondary_voltage);
ar & BOOST_SERIALIZATION_NVP(_impedance1);
ar & BOOST_SERIALIZATION_NVP(_impedance2);
ar & BOOST_SERIALIZATION_NVP(_location);
}
std::string _name;
bu::quantity<si::electric_potential> _primary_voltage;
bu::quantity<si::electric_potential> _secondary_voltage;
bu::quantity<si::resistance, std::complex<double>> _impedance1;
bu::quantity<si::resistance, std::complex<double>> _impedance2;
Data_location _location;
我嘗試了所有的信息,但是仍然我有這樣的錯誤:
error C2039: 'serialize' : is not a member of 'boost::units::
quantity<boost::units::si::electric_potential,double>'
我正在尋找最簡單的方式來解決這個問題。 謝謝 in this picture the code when i use the type electrical_potential
顯示導致編譯錯誤的代碼。 – Dennis
在類access.hpp:在此函數模板<類存檔,類T> 靜態無效的serialize( 歸檔和AR, T&噸, const的無符號整型FILE_VERSION ){ t.serialize(AR,FILE_VERSION ); } – Saad
編輯原始文章以包含您的代碼 – Dennis