Closed LTLA closed 7 years ago
Done, albeit in an ugly and highly non-idiomatic way. Basically just set up Rcpp::RObject
data members for each class so that the pointers of the class are always pointing to PROTECTed data across the lifetime of the class. The API still returns pointers of values, we're not using the Rcpp
row/column objects.
Wondering whether I should switch to
Rcpp
, in light of the recent discussion about changes to memory allocation andPROTECT
philosophies in R's C API. There are two options for doing so:Rcpp::Matrix
. This would be painful because we'd have to be sure that we properly implement all of theMatrix
methods, conversions, etc., to honour what users might expect from a derived class. Most of these we probably don't need for basic data storage and access. It also seems that theMatrix
class declaration doesn't haveprotected
members/methods, onlyprivate
ones; I don't think that we can actually get at internal variables likenrows
.Rcpp
, and the front-end is still under our control. This is relatively easy to do, notwithstanding my ignorance ofRcpp
, and should ensure that the code is robust to changes in the need forPROTECT
.As the tone suggests, I favour the latter. But if an
Rcpp
expert is willing to help, we could do the former.