Hello,

I need to interface some R code with a numerical library containing functions 
taking as input double*

What is the most efficient way to create an array of doubles from a 
NumericVector.

I was thinking of something like:






// input is of type Rcpp::NumericVector and passed from R
std::vector<double> vec;
std::copy(input.begin(), input.end(), std::back_inserter(vec));

double* values = &vec[0];

// now call function taking a double*


Regards,

Anwar
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to