[Rcpp-devel] Template argument deduction with R objects
fisikop at gmail.com
Sun Oct 14 01:11:11 CEST 2018
thanks for the quick reply! "TYPEOF" is runtime right? I want
something compile time,
i.e. depending on the type of the R object deduce a type to be fed to
a templated function.
On Sun, 14 Oct 2018 at 01:24, Qiang Kou <qkou at qkou.info> wrote:
> 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
> On Sat, Oct 13, 2018 at 2:49 PM Vissarion Fisikopoulos <fisikop at gmail.com> wrote:
>> 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
>> 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?
>> Rcpp-devel mailing list
>> Rcpp-devel at lists.r-forge.r-project.org
More information about the Rcpp-devel