Re: [Rcpp-devel] Template argument deduction with R objects

2018-10-13 Thread Dirk Eddelbuettel
On 14 October 2018 at 02:11, Vissarion Fisikopoulos wrote: | Hi Qiang, | | 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. In short, you can't. R only has on

Re: [Rcpp-devel] Template argument deduction with R objects

2018-10-13 Thread Vissarion Fisikopoulos
Hi Qiang, 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. Best, Vissarion. On Sun, 14 Oct 2018 at 01:24, Qiang Kou wrote: > > Hi, Vissarion, > > If I understand your

Re: [Rcpp-devel] Template argument deduction with R objects

2018-10-13 Thread Qiang Kou
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/