问题
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