Transform a boost::array into NumericVector in Rcpp
In my C++ script (run in R using Rcpp), I defined : typedef boost::array< double ,3 > state_type; Now, I want to create a function to transform a state_type variable to a Rcpp::NumericVector variable, and another function that do the inverse. How can do that? I need to do that in order to use R function into C++. How about Rcpp::NumericVector boost_array_to_nvec(state_type const& s) { Rcpp::NumericVector nvec(s.size()); for (size_t i = 0; i < s.size(); ++i) { nvec[i] = s[i]; } return nvec; } state_type nvec_to_boost_array(Rcpp::NumericVector const& nvec) { state_type s; for (size_t i = 0; i <