2010-09-02 39 views

回答

1

未經檢驗的,但你要專門的boost ::系列化::歸檔爲您的數據類型:

 
namespace boost { 
namespace serialization { 

template<class Archive> 
void serialize(Archive & ar, std::wstring& s, const unsigned int version) 
{ 
    for (std::wstring::iterator it = s.begin(); it != s.end(); ++it) 
     ar >> *it 
} 

} // namespace serialization 
} // namespace boost 

此代碼應的基本工作原理爲,是,你只是想改變的內容序列化功能(但不簽名。)的

爲什麼你要以其他任何方式序列化的wstring不僅僅是打印它(即只用正常輸入輸出流),我不知道。

+0

有什麼想法? 測試代碼在這裏:http://liveworkspace.org/code/5f8a62c02c8cf96a909666ad8b40a6e5 – niXman 2010-12-26 10:04:16

相關問題