[Rcpp-devel] How to access fields and methods of a RefClass from C++?
Dirk Eddelbuettel
edd at debian.org
Thu May 30 18:12:56 CEST 2013
On 30 May 2013 at 18:01, Romain Francois wrote:
| Le 30/05/13 16:02, Dirk Eddelbuettel a écrit :
| >
| > On 30 May 2013 at 15:15, Romain Francois wrote:
| > | More easily, you can use Rcpp::Reference:
| > |
| > | // [[Rcpp::export]]
| > | std::string getId(Reference obj) {
| > | std::string txt = obj.field("id");
| > | return txt;
| > | }
| >
| > Thanks -- had forgotten about that one.
| >
| > Would you mind cooking up a quick unit test for this as a reminder?
| >
| > Dirk
|
| Done. Added the exemple verbatim. Feel free to add more tests.
Thanks and may do -- planning to write an Rcpp Gallery post on this as it
needs more exposure.
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list