# Rcpp 0.10.5

September 29, 2013
By

(This article was first published on Thinking inside the box , and kindly contributed to R-bloggers)

A new version of Rcpp is now on the CRAN network for GNU R; binaries for Debian have been uploaded as well.

Once more, this release brings a large number of exciting changes to Rcpp. Some concern usability, some bring new features, some increase performance; see below for the detailed list. We have now released three updates on a quarterly cycle; if we keep this up the next version ought to be ready at the end of December.

As in the past, we tested the release rather rigorously by checking against all packages I could (relatively easily) built on my server: this time it successfully passed \code{R CMD check} for all 107 packages I can build locally out of a total of 136 packages. (Two failed: one for an error in \code{Makevars}, and one for the need of an X11 server during tests; this may get addressed in the in test script next time). As all of these 107 packages passed, we do not expect any issues with dependent packages. Should there be issues we would appreciate a note, preferably with reproducible code, to the rcpp-devel mailing list.

The complete NEWS entry for 0.10.4 is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.

#### Changes in Rcpp version 0.10.5 (2013-09-28)

• Changes in R code:

• New R function demangle that calls the DEMANGLE macro.

• New R function sizeof to query the byte size of a type. This returns an object of S3 class bytes that has a print method showing bytes and bits.

• Changes in Rcpp API:

• Add defined(__sun) to lists of operating systems to test for when checking for lack of backtrace() needed for stack traces.

• as<T*>, as<const T*>, as<T&> and as<const T&> are now supported, when T is a class exposed by modules, i.e. with RCPP_EXPOSED_CLASS

• DoubleVector as been added as an alias to NumericVector

• New template function is<T> to identify if an R object can be seen as a T. For example is<DataFrame>(x). This is a building block for more expressive dispatch in various places (modules and attributes functions).

• wrap can now handle more types, i.e. types that iterate over std::pair<const KEY, VALUE> where KEY can be converted to a String and VALUE is either a primitive type (int, double) or a type that wraps. Examples :

• std::map<int, double> : we can make a String from an int, and double is primitive

• boost::unordered_map<double, std::vector<double> >: we can make a String from a double and std::vector<double> can wrap itself

Other examples of this are included at the end of the wrap unit test file (runit.wrap.R and wrap.cpp).

• wrap now handles containers of classes handled by modules. e.g. if you expose a class Foo via modules, then you can wrap vector<Foo>, ... An example is included in the wrap unit test file.

• RcppLdFlags(), often used in Makevars files of packages using Rcpp, is now exported from the package namespace.

• Changes in Attributes:

• Objects exported by a module (i.e. by a RCPP_MODULE call in a file that is processed by sourceCpp) are now directly available in the environment. We used to make the module object available, which was less useful.

• A plugin for openmp has been added to support use of OpenMP.

• Rcpp::export now takes advantage of the more flexible as<>, handling constness and referenceness of the input types. For users, it means that for the parameters of function exported by modules, we can now use references, pointers and const versions of them. The file Module.cpp file has an example.

• No longer call non-exported functions from the tools package

• No longer search the inline package as a fallback when loading plugins for the the Rcpp::plugins attribute.

• Changes in Modules:

• We can now expose functions and methods that take T& or const T& as arguments. In these situations objects are no longer copied as they used to be.

• Changes in sugar:

• is_na supports classes DatetimeVector and DateVector

• Changes in Rcpp documentation:

• The vignettes have been moved from inst/doc/ to the vignettes directory which is now preferred.

• The appearance of the vignettes has been refreshed by switching to the Bistream Charter font, and microtype package.

• Deprecation of RCPP_FUNCTION_*:

• The macros from the preprocessor_generated.h file have been deprecated. They are still available, but they print a message in addition to their expected behavior.

• The macros will be permanently removed in the first Rcpp release after July 2014.

• Users of these macros should start replacing them with more up-to-date code, such as using 'Rcpp attributes' or 'Rcpp modules'.

Thanks to CRANberries, you can also look at a diff to the previous release 0.10.4. As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page