Serialization for Rcpp exposed class

末鹿安然 提交于 2019-12-10 16:46:37

问题


I've written a C++ class in an R package that I expose to the R namespace with RCPP_EXPOSED_CLASS and RCPP_MODULE.

Everything works great:

> index
An object of class "Index"
Slot "index":
C++ object <0x9cd4810> of class 'DB' <0xfd66220>

but if saveRDS(index, 'DB.rds') it does not save the actual object just the address. In turn it is casted as invalid when I load the DB.rds in a new session.

Is it possible to write a custom serialization method that could work transparently with saveRDS ?

来源:https://stackoverflow.com/questions/50582388/serialization-for-rcpp-exposed-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!