Re: [Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Simon Zehnder
Hi Romain, first let me thank you for the very fast and informative answer! I suppose, as SEXP is a pointer, that these attempts reuse the memory allocated in R, right? Further, I presume, that I proceed in the same way for lists from R to Rcpp, don't I? In regard to the initialisation list:

Re: [Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Romain Francois
There is no constructor of Matrix tht takes a SlotProxy. You can do it in two steps perhaps. SEXP tmp = classS4.slot("M_R") ; M = tmp ; Or use a specific cast: > M((SEXP)classS4.slot("M_R")); In any case, you should use an initialisation list in your constructor anyway, something like: >

[Rcpp-devel] Initiate NumericMatrix in class constructor from S4 slot

2013-03-05 Thread Simon Zehnder
Dear Rcpp-Devels, I am a little confused right now with the following setting: I have a C++ class with for example the following header #include class FirstClass { public: Rcpp::NumericMatrix M; FirstClass(Rcpp::S4& classS4); ~F