升压系列化:档案"不受支持的版本"例外 [英] Boost serialization: archive "unsupported version" exception
本文介绍了升压系列化:档案"不受支持的版本"例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Iv'e得到了这个异常,当我尝试通过文本反序列化存档的一些数据$ P $与提升的版本上连载pviously(1.46序列化和1.38反序列化)...有没有办法降级(在code)序列化?像set_library_version?谢谢...
Iv'e got this exception when I try to deserialize through a text archive some data previously serialized with a upper version of boost (1.46 to serialize and 1.38 to deserialize)...is there a way to downgrade (in the code) the serialization?something like "set_library_version"?thanks...
推荐答案
请参见错误读取二进制档案,由老提振版本创建的电子邮件存档有关序列化的错误。
See Error read binary archive, created by old boost version mail archive about serialization error.
它说,下面的code做这项工作。
It says that the code below does the job
void load_override(version_type & t, int version){
library_version_type lvt = this->get_library_version();
if(boost::archive::library_version_type(7) < lvt){
this->detail_common_iarchive::load_override(t, version);
}
else
if(boost::archive::library_version_type(6) < lvt){
uint_least16_t x=0;
* this->This() >> x;
t = boost::archive::version_type(x);
}
else
if(boost::archive::library_version_type(3) == lvt || boost::archive::library_version_type(5) == lvt ){
#pragma message( "CTMS fix for serialization bug ( lack of backwards compatability ) introduced by boost 1.45." )
// upto 255 versions
unsigned char x=0;
* this->This() >> x;
t = version_type(x);
}
else{
unsigned int x=0;
* this->This() >> x;
t = boost::archive::version_type(x);
}
}
这篇关于升压系列化:档案&QUOT;不受支持的版本&QUOT;例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文