[Rcpp-devel] What is the best way of handling default arguments.

Dirk Eddelbuettel edd at debian.org
Thu May 24 20:53:02 CEST 2012

On 24 May 2012 at 12:34, Andrew Redd wrote:
| Rcpp List,
| Is there a recommended way to handle default arguments for
| constructors?  I have a class that I have created and exposed through
| Rcpp Modules.   I now found that I need to expose a tuning parameter
| and need to modify my constructors.   The standard way would be to
| include just a default argument, but I didn't think that Rcpp could
| handle default arguments in constructors.    Am I wrong?  Any
| recommendations?

I think you are correct.  

So you may have to make do with just setting a default value in the existing
constructor's body, and offering an additional setter.

Rcpp modules are a sort-of half-way house between the full glory of C++ and
the more direct interactive nature of R. Not everything can be mapped that
way, and we point to class member functions by name only.


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

More information about the Rcpp-devel mailing list