<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 31, 2013 at 3:55 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 31 December 2013 at 15:27, Tim Keitt wrote:<br>
| A little obscure indeed. I got a little lost in the documentation and was<br>
| looking for a shortcut. I think I need to specialize "wrap" and "as".<br>
<br>
</div>Yes, many adaptations to local data structures need that. There are a few<br>
example posts, eg on the Rcpp Gallery (<a href="http://gallery.rcpp.org" target="_blank">http://gallery.rcpp.org</a>) which should<br>
get you started.<br></blockquote><div><br></div><div>Tried it out. There is however an issue using it with attributes with Rcpp::export, which is that types defined in the source file do not get carried over to RcppExports.cpp, at least as far as I can tell. So</div>

<div><br></div><div>class target { ... } ;</div><div><br></div><div>target as<target>(SEXP x) { ... }</div><div>SEXP wrap<target>(const target& x) { ... }</div><div><br></div><div>[[Rcpp::export]]</div><div>

target doSomething(target x)</div><div>{</div><div>...</div><div>}</div><div><br></div><div>does not work because the type "target" is undefined in the RcppExports.cpp file.</div><div><br></div><div>Is there a way to include an arbitrary header in RcppExports.cpp?</div>

<div><br></div><div>THK</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Timothy H. Keitt<br><a href="http://www.keittlab.org/" target="_blank">http://www.keittlab.org/</a><br>
</div></div>