Douglas M. Bates, Saikat DebRoy
C++ Classes for R Objects
*******************************
When creating the R Matrix package, which provides access to the
Fortran Lapack and BLAS3 routines, we patterned the functions after
the corresponding S-PLUS library but chose a completely different
implementation. We based the R implementation on the lapack++
classes that provide C++ wrappers for the Lapack code.
There are several advantages to using C++ instead of C
for code that will be called from R. In particular it is
possible to encapsulate some of the S-language class structure
in the C++ classes. There are also disadvantages to using
C++. We discuss these for the particular example of the Matrix
package and also describe a more general approach of reflecting
basic R object types in C++ classes.