[Rcpp-devel] integer arrays as arguments for a module function

Chris DuBois chris.dubois at gmail.com
Fri Aug 12 23:50:29 CEST 2011


Hi all,

I'm trying to figure out how to pass in an array of integers to a function
inside a module.  For example, adding the following function to
runit.Module.R works fine:

        int bla3( IntegerVector x ) {
              return sum(x);
        }

However, I need to pass an int array, rather than an IntegerVector.  Using
int x[] in the arguments doesn't compile (though I'm unfamiliar with C++ in
general, so maybe this shouldn't work anyway).

Alternatively, should I just cast x from an IntegerVector to an int array?
 I tried various permutations of as, vector, <int>, etc, and would like to
learn the proper way of doing this.

Thanks in advance,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110812/6ed90a35/attachment.htm>


More information about the Rcpp-devel mailing list