Hi, I have an enum defined in a C++ library that I would like to export to R. I saw some references to enums in pkg/Rcpp/inst/include/Rcpp/module/Module.h but I could not find any examples of enums being used. Through trial and error I figured out that I could create a dummy class and add the enum to that (see code below). Can I export the enum directly? I saw references to RCPP_EXPOSED_ENUM but I could not figure out how to use that macro. Any help or pointers to examples where enums are used would be appreciated.
Regards, Sameer #include "Rcpp.h" using namespace Rcpp; class Dummy { int x; int get_x() {return x;} }; enum MyEnum {ENUM0, ENUM1, ENUM2}; RCPP_MODULE(EnumMod) { class_<Dummy>("EnumMod") .default_constructor() ; enum_<MyEnum, Dummy>("EnumType") .value("Enum0", ENUM0) .value("Enum1", ENUM1) .value("Enum2", ENUM2) ; }
_______________________________________________ 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