[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

The return value of this macro is an integer:

Hadley also gives several examples in



On Sat, Oct 13, 2018 at 2:49 PM Vissarion Fisikopoulos <fisikop at gmail.com>

> 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