You posted twice.

This looks like something related to const ness. I'll have a look at what I can do. Seems like we need to add some const in the
Module_generated_CppMethod.h file

e.g.

SEXP operator()( Class* object, SEXP*) const {
        return Rcpp::module_wrap<OUT>( (object->*met)( ) ) ;
}

...

Romain

Le 02/04/13 13:15, Robin Girard a écrit :
Hello list,
I'm having troubles using module on a class that redefines a vector of Mytype 
where Mytype is type that has several children types. Mytype has only methods 
while cihldren inherit methods and have fields that are double or integer or 
string.

- when I remove inheritance everything work fine.
- with inheritance, when I remove the push_back function redeclaration 
everything works fine
- I am using the .derives in the module definitions

I understand that I fully fall into the known shortcomming annouced in the Rcpp 
module vignette, I have tryed to read more about wrap (where my problem seems 
to be) digging into RcppArmadillo and RcppGSL, but it's a bit over my level of 
understanding for now since I'm new to cpp and don't fully understand template 
programming. I would like to know if there is a simple workaround in my case.

The end of the error message in case this helps (Mytype is consumptionMean):

C:/R/R-2.15.2/library/Rcpp/include/Rcpp/internal/wrap.h:882:96:   instantiated from 
'SEXPREC* Rcpp::module_wrap(const T&) [with T = consumptionMean, SEXP = 
SEXPREC*]'
C:/R/R-2.15.2/library/Rcpp/include/Rcpp/module/Module_generated_CppMethod.h:104:138:  
 instantiated from 'SEXPREC* Rcpp::CppMethod1<Class, OUT, 
U0>::operator()(Class*, SEXPREC**) [with Class = consumptionMean_vec, OUT = 
consumptionMean, U0 = int, SEXP = SEXPREC*]'
Mymodules.cc:84:1:   instantiated from here
C:/R/R-2.15.2/library/Rcpp/include/Rcpp/internal/wrap.h:451:11: error: passing 
'const consumptionMean' as 'this' argument of 'consumptionMean::operator 
SEXP()' discards qualifiers

Best
R.

Dr. Girard Robin
Chargé de Recherche

MINES-ParisTech / Département Energétique et Procédés / PERSEE / Groupe ERSEI
Centre Procédés, Energies Renouvelables et Systèmes Energétiques (PERSEE)
Center for Processes, Renewables Energies and Energy Systems
Renewable Energies & Smartgrids (ERSEI)

1 Rue Claude Daunesse - CS 10207 - F-06904 Sophia Antipolis Cedex
Tel: +33.4.93.67.89.64 (~99), Fax: +33.4.93.95.75.35
e-mail : robin.gir...@mines-paristech.fr

web page perso http://www.mines-paristech.fr/Services/Annuaire/&?id=8828
statoverflow : http://stats.stackexchange.com/users/223/robin-girard
web page centre PERSEE : http://www.cep.mines-paristech.fr/
linkedin : http://www.linkedin.com/profile/view?id=14907272&trk=tab_pro


--
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

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to