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 one type, so to speak -- SEXP -- and you need to decide at run-time _what type it may carry_. See eg http://gallery.rcpp.org/articles/rcpp-wrap-and-recurse/ as well as several answers on StackOverflow and in the list archives. Because R allows a <- 1L; myFunc(a) as well as other variable for a, this does not map so well. Such is life when interfacing a dynamic language. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ 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