[Rcpp-devel] Template argument deduction with R objects
Qiang Kou
qkou at qkou.info
Sun Oct 14 00:24:26 CEST 2018
Hi, Vissarion,
If I understand your problem correctly, you can use "TYPEOF" from R's C API.
You can find more info on the type of an R object from
https://cran.r-project.org/doc/manuals/r-release/R-ints.html#SEXPTYPEs
The return value of this macro is an integer:
https://github.com/wch/r-source/blob/master/src/include/Rinternals.h#L94-L126
Hadley also gives several examples in
http://adv-r.had.co.nz/C-interface.html
Best,
KK
On Sat, Oct 13, 2018 at 2:49 PM Vissarion Fisikopoulos <fisikop at gmail.com>
wrote:
> Hi,
>
> I am working on a rcpp project. I have a set of templated C++ classes
> and templated C++ functions that accept any object from that set of
> classes as parameter. I want to expose this functionality to R using
> Rcpp. That is, the R user could create objects (that correspond to the
> set of C++ classes) and then call a function with those objects as
> parameters.
>
> My main issue is that I cannot extract from an R Class any type that
> can be used to parameterise a C++ templated function.
>
> Is there a standard way to do such an exposion within rcpp?
>
> Best,
> Vissarion
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20181013/314e2f61/attachment.html>
More information about the Rcpp-devel
mailing list