[Rcpp-devel] Ease passing pointers

Tim Keitt tkeitt at gmail.com
Tue Dec 31 23:58:48 CET 2013


On Tue, Dec 31, 2013 at 3:55 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 31 December 2013 at 15:27, Tim Keitt wrote:
> | 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".
>
> Yes, many adaptations to local data structures need that. There are a few
> example posts, eg on the Rcpp Gallery (http://gallery.rcpp.org) which
> should
> get you started.
>

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

class target { ... } ;

target as<target>(SEXP x) { ... }
SEXP wrap<target>(const target& x) { ... }

[[Rcpp::export]]
target doSomething(target x)
{
...
}

does not work because the type "target" is undefined in the RcppExports.cpp
file.

Is there a way to include an arbitrary header in RcppExports.cpp?

THK




>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>



-- 
Timothy H. Keitt
http://www.keittlab.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131231/9b1bd80b/attachment.html>


More information about the Rcpp-devel mailing list