[Rcpp-devel] idiom for printing a message when a destructor is invoked
Douglas Bates
bates at stat.wisc.edu
Thu Dec 15 23:48:52 CET 2011
I am communicating back and forth between R reference classes and C++
classes through external pointers and it seems that the C++ object is
being destroyed prematurely. I will look more carefully at the
Rcpp::Xptr class to ensure that the C++ object is preserved until the
R object is garbage collected but, for now, I would like to pinpoint
when the destructor for the C++ class is being called on the object.
I'm sure there must be an idiom for inserting something like
Rcpp::Rcout << "Destructor being called on object of class foo" << std::endl;
in a destructor then chaining to the standard destructor but I can see
anything like that right now. That is, I don't know how to chain to
the standard destructor.
Any suggestions?
More information about the Rcpp-devel
mailing list