[Rcpp-devel] Modules and default constructors

John Chambers jmc4 at stanford.edu
Fri Nov 19 18:59:55 CET 2010


There was a problem in that creating a subclass in R of an Rcpp class 
attempts to call a default constructor.

I have code that fixed the problem, by creating a suitable $initialize() 
method based on the existence or not of the default C++ constructor, but 
unfortunately I have yet to fully test & commit the change, and I'm off 
in a few minutes for today.

So, sorry, you probably still need a default constructor as a workaround 
if you intend to define a subclass but, with luck, soon you won't.

John

On 11/19/10 7:06 AM, Douglas Bates wrote:
> I believe it is now recommended that a class to be exposed in a module
> should expose a default constructor (i.e. a constructor called with no
> arguments).  Is such a constructor actually called or is it just there
> to establish the necessary linkage?  In a class where it would not
> make sense to construct an object without arguments I was going to
> have the default constructor throw an exception but that might not be
> a good idea.  I seem to recall the discussion between John and Romain
> indicating that it must be called during the initialization of the
> reference class in R.
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>


More information about the Rcpp-devel mailing list