我正在嘗試將序列化集成到我的代碼中。但是,我得到一個'沒有成員名爲'錯誤。我正在閱讀的書說,std :: pair不需要包含頭文件並且不存在。如何解決這個錯誤? 我的代碼如下所示:'struct std :: pair <int, int>'has no member named'serialize'
#include <iostream>
//ofstream/ifstream
#include <fstream>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
//stringstream
#include <sstream>
//
#include <boost/serialization/complex.hpp>
#include <boost/serialization/bitset.hpp>
//#include <boost/serialization/
//BOOST_BINARY
#include <boost/utility/binary.hpp>
using namespace std;
int main()
{
complex<double> c(1,0);
bitset<3> b(BOOST_BINARY(101));
pair<int,int> p(1,2);
string s;
std::stringstream ss(s);
boost::archive::text_oarchive oa(ss);
oa<<c<<b<<p;
{
complex<double> c;
bitset<3> b;
pair<int,int> p;
boost::archive::text_iarchive ia(ss);
ia>>c>>b>>p;
}
return 0;
}
'std :: pair'在''中定義。 –
2013-04-21 12:02:01