<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 31, 2013 at 3:10 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 14:16, Tim Keitt wrote:<br>
| Can the following be simplified?<br>
|<br>
| (Typed in email, so not live code.)<br>
|<br>
| // [[Rcpp::export]]<br>
| void func(SEXP x)<br>
| {<br>
|   XPtr<aType> y(x);<br>
|   func2(&*y);<br>
|   y->memfunc();<br>
| }<br>
|<br>
| Is there a way to avoid the need to construct the XPtr in the 1st line? Hoping<br>
| for:<br>
|<br>
| // [[Rcpp::export]]<br>
| void func(aType* x)<br>
| {<br>
|   func2(x);<br>
|   x->memfunc();<br>
| }<br>
<br>
</div>We don't know what func2() is, or what it's signature is. Ditto for y.<br>
<br>
In general, we go the route of using XPtr if we need to get the pointer back<br>
to R, maybe because our R logic then dispatches it somewhere else.<br>
<br>
Your examples are admiringly short, which is very good. They are also<br>
incomplete and a little incomprehensible which is less good :)<br>
<br>
Cheers, Dirk<br>
<span class="HOEnZb"><font color="#888888"><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>
</font></span></blockquote></div><br>A little obscure indeed. I got a little lost in the documentation and was looking for a shortcut. I think I need to specialize "wrap" and "as".</div><div class="gmail_extra">

<br></div><div class="gmail_extra">THK<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>