I want to avoid making a copy of the entire list (my real-world application might have lots of different elements for each element of the "master" list). But what works fine is if, within the loop, I do the Rcpp-to-double conversion, and then call a version of the function that takes a double as an argument, instead of the SEXP. So I think there is something going on with passing the SEXP to func, and then using Rcpp::as to convert the SEXP to double.
Is this close to what you are asking? On Jul 27, 2011, at 1:26 PM, Davor Cubranic wrote: > On 2011-07-26, at 8:01 PM, Michael Braun wrote: > >> Dirk: >> >> I am sorry I was not clearer about what I am trying to accomplish. The >> issue is with operating on elements of an Rcpp::List object in parallel. > > Can you copy the list to a regular double array or std::vector, operate on > that in your parallel loop (taking care to avoid any bits of R interpreter > since it's single-threaded), and then outside the loop wrap/copy that into an > R data structure that you can return as the result of the function? > > Davor > _______________________________________________ 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