[Rcpp-devel] Module with vector of a class with inheritance, how to avoid slicing

Romain Francois romain at r-enthusiasts.com
Wed Apr 3 20:43:56 CEST 2013


Le 03/04/13 20:15, Dirk Eddelbuettel a écrit :
>
> Robin,
>
> Section 'Known Shortcomings' in the Rcpp-modules vignette says
>
>    \item mulitple inheritance: currently, only simple class structures are
>       representable via \textsl{Rcpp modules}.
>
> If you want multiple inheritance you may need to let go of modules.
> Unless of course Romain has another pair of aces up his sleeves. All bets are
> off in those cases.
>
> Dirk

The doc has not been updated with the inclusion of .derives<>. I should 
update it.

This has nothing to do with *multiple* inheritance. We support 
inheritance, that is all that is needed here.

This is classic C++ slicing.

A typical way around slicing is to use the PIMPL idiom.

I'll reply to the original question later.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://blog.r-enthusiasts.com
|- http://bit.ly/ZTFLDo : Simpler R help tooltips
`- http://bit.ly/YFsziW : R Help tooltips



More information about the Rcpp-devel mailing list