Skip to content

[Rcpp-devel] wrap documentation?

2 messages · Toby Hocking, Dirk Eddelbuettel

#
Hi, can someone please tell me where the return types of wrap are
documented?

For context, I was looking at the Advanced R chapter on Rcpp
http://adv-r.had.co.nz/Rcpp.html which shows an example of a C++ function
with the Rcpp::exports attribute, that returns a std::map, and I was
wondering how the std::map is returned in R. (I assume this will generate
an RcppExports.cpp which calls wrap on the result) I'm wondering what the
returned SEXP type will be?

For clarification this is more of a question about documentation -- is
there a place where I can find a table/mapping from currently implemented
C++ wrap inputs to returned SEXP types? e.g. NumericVector in C++ ->
numeric vector in R, int in C++ -> integer vector in R, etc

FYI I tried looking in the doxygen/rcpp-devel archives/google and in the
Rcpp inst/include source code, but I did not find the answer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200425/e838ed9a/attachment.html>
#
On 25 April 2020 at 16:04, Toby Hocking wrote:
| Hi, can someone please tell me where the return types of wrap are
| documented?

The _return_ value of a wrap() call is by definition always SEXP.
Just how the _input_ for as<>() converters is always a SEXP.

For wrap(), see e.g. Section 3.1 of the JSS 2011 paper which ships as
vignette Rcpp-jss-2011.pdf

Hth,  Dirk