Created
July 8, 2014 10:13
-
-
Save floswald/ffa0e77370e03872f6ac to your computer and use it in GitHub Desktop.
Rcpp::NumericVector -> std::vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(inline) | |
body='NumericVector xx(x); | |
std::vector<double> X(xx.begin(),xx.end()); | |
for (int i = 0;i<X.size();i++) { | |
std::cout << "X[i] = " << X.at(i) << std::endl; | |
} | |
return (xx);' | |
tfun = cxxfunction(signature(x="numeric"),body,plugin="Rcpp") | |
tfun(c(1,2.2,4,3.19) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment