Is it possible with Rcpp Modules to have a class that does not have a
default constructor?  Consider this example
-----
#include <R.h>
#include <Rcpp.h>
class c1{
private:
int n;
int * x;
c1();
public:
c1(int n):n(n){}
int getn(){return n;}
};
RCPP_MODULE(c1){
using namespace Rcpp;
class_<c1>("c1")
.property("n",&c1::getn)
;
}
-----
Here I have a class that I do not want to allow to initialize without
specifying n.  Yes it does not do anything but the question is related to a
class where constructors and destructors allocate and free special memory.
And Yes I know that this fails on compile since c1() is private. Can Rcpp
handle this kind of setup?  If not suggestions about workarounds?

thanks,
Andrew
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to