[Rcpp-devel] Preferred way to create an instance of a C++ class exported in a module?
romain at r-enthusiasts.com
romain at r-enthusiasts.com
Tue Nov 30 17:31:12 CET 2010
I'd say up to you. I prefer the new( Class , ... ) construct.
Also, with Rcpp 0.8.9 with populate, you dont need to use the $ so much.
You can, in your .onLoad call populate once and then just use the class. See the Rcpp-modules vignette.
Romain
Le 30 nov. 2010 à 05:21 PM, Douglas Bates <bates at stat.wisc.edu> a écrit :
> I have seen a couple of ways of creating an instance of a C++ class
> exported in a module
>
> mod <- Module("myMod", "myPackage")
> cls <- mod$myClass
> inst <- cls$new(constructorArgs)
>
> and
>
> inst <- new(mod$myClass, constructorArgs)
>
> Is one of these the preferred way?
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
More information about the Rcpp-devel
mailing list