Skip to content
Back to formatted view

Raw Message

Message-ID: <BANLkTindQd55RrcSDoqkgDsLiigEeEvJGA@mail.gmail.com>
Date: 2011-06-02T20:31:27Z
From: Douglas Bates
Subject: [Rcpp-devel] Create an instance of a reference class for a C++ class exported as a module from within C++?

Sorry for the long subject line but I hope it describes what I want to
do.  I have a C++ class, dgTMatrix, that is exported in a module
definition.

RCPP_MODULE(RcppSp) {
...
    class_<dgCMatrix>("dgCMatrix")
    ...
    ;
}

Many of the methods for this class return other members of this class.
 Can I create a new instance of the reference class in R from within
the module?  I'm sure it is possible, I'm just wondering if there is
an easy way to do this without duplicating large chunks of the code in
Rcpp/src/Module.cpp.  Can i somehow clone the SEXP representing the
current instance then swap the external pointer to the C++ object?