[Rcpp-devel] function modifying it self its argument

Dirk Eddelbuettel edd at debian.org
Thu Feb 26 18:59:34 CET 2015

On 26 February 2015 at 18:35, Matt D. wrote:
| Which incidentally brings me to the advice I usually give in these situations:
| unless you're absolutely dependent on the "features" of `Rcpp::NumericVector`
| just forget about it and replace all uses with the standard container
| `std::vector<double>`.

Note that this means you will always force a copy on the way in, and on the
way out.  That is a guaranteed performance penalty.

So with this you guarantee that someone else will always be able to write
faster code.  That said, I too like std::vector<>, but I also like arma::vec,
and those are (in the recent versions) lightweight.

| found" at the moment -- and, as mentioned in another reply, you're apparently
| expected to Google around to find methods for solving problems you wouldn't

We have called these object "proxy models" since almost certainly 2010.  This
is referenced in the standard introductory paper (published peer-reviewed in
JSS in 2011) and included as a vignette in the package. 

If you ignore the avilable documentation, then you may indeed have to "google
at random" as you claim.  I'd call that a self-inflicted wound.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list