<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Le 27/04/2020 à 18:55, Toby Hocking a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CALK03d0KbywFxE-L_PbTicfFAZNfHv8ZxwJyMGY8Fj=-RLZpaA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi Dirk and Sokol, thanks for the responses.</div>
        <div>Dirk I was aware that the C/C++ output type of wrap is
          always SEXP, but I my question was about the R type/class.</div>
        <div>Also thanks for the ref of the discussion in Sec 3.1 of the
          JSS 2011 article, which is pretty much what I was looking for,
          but it seems to be incomplete. I can deduce from the example
          that std::vector becomes a list in R, and std::map<string,
          int> becomes a named integer vector in R, but I am looking
          for a list of all such conversions that have currently been
          implemented.</div>
        <div>I guess there is no such documentation, and we should
          instead refer to the source code as Seugeui pointed out?</div>
        <div>In that case I find it a bit problematic, because there are
          lots of conversions that are possible, but not obvious upon
          inspection of wrap.h. For example the std::vector -> R list
          conversion is not obvious (I don't see any mention of
          std::vector in wrap.h actually). <br>
        </div>
      </div>
    </blockquote>
    Because std::vector can have any type of element, e.g. vector of
    vectors, the procedure has to be generic enough. So it is realized
    through iterators which are not exclusive for std::vector.<br>
    E.g. for vector of pairs <string, some_type> it is probably
    this procedure which will be called:<br>
<a class="moz-txt-link-freetext" href="https://github.com/sgsokol/Rcpp/blob/acf8756a75a97ee203e261412a2ab3fa7d6e15c7/inst/include/Rcpp/internal/wrap.h#L334">https://github.com/sgsokol/Rcpp/blob/acf8756a75a97ee203e261412a2ab3fa7d6e15c7/inst/include/Rcpp/internal/wrap.h#L334</a><br>
    It will produce a named list in R.<br>
    <br>
    Best,<br>
    Serguei.
    <p><br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CALK03d0KbywFxE-L_PbTicfFAZNfHv8ZxwJyMGY8Fj=-RLZpaA@mail.gmail.com">
      <div dir="ltr">
        <div>As an Rcpp user I think it would be very helpful to have a
          list/table that documents all the currently implemented
          conversions. Would that be very difficult to write by hand /
          generate from the source code?<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sun, Apr 26, 2020 at 12:07
          AM Sokol Serguei <<a href="mailto:sokol@insa-toulouse.fr"
            moz-do-not-send="true">sokol@insa-toulouse.fr</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le
          26/04/2020 à 01:19, Dirk Eddelbuettel a écrit :<br>
          > On 25 April 2020 at 16:04, Toby Hocking wrote: | Hi, can
          someone <br>
          > please tell me where the return types of wrap are |
          documented? The <br>
          > _return_ value of a wrap() call is by definition always
          SEXP. Just how <br>
          > the _input_ for as<>() converters is always a SEXP.
          For wrap(), see <br>
          > e.g. Section 3.1 of the JSS 2011 paper which ships as
          vignette <br>
          > Rcpp-jss-2011.pdf <br>
          To complete the Dirk's response, this gallery example can be
          of some help:<br>
          <a
href="https://gallery.rcpp.org/articles/custom-templated-wrap-and-as-for-seamingless-interfaces/"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://gallery.rcpp.org/articles/custom-templated-wrap-and-as-for-seamingless-interfaces/</a><br>
          <br>
          And as always, an ultimate place to clarify the trickiest
          questions is <br>
          the code itself ;) :<br>
          <a
href="https://github.com/sgsokol/Rcpp/blob/master/inst/include/Rcpp/internal/wrap.h"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://github.com/sgsokol/Rcpp/blob/master/inst/include/Rcpp/internal/wrap.h</a><br>
          <br>
          Best,<br>
          Serguei.<br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Rcpp-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>