[Rcpp-devel] Using module with std::vector<Mytype> when Mytype has children with inheritence

Ahmadou Dicko dicko.ahmadou at gmail.com
Tue Apr 2 13:40:25 CEST 2013


Just want to add that you'll have more chance to get answer if you can give
us a  reproductible, simple example of this problem.



On Tue, Apr 2, 2013 at 11:32 AM, Robin Girard <
robin.girard at mines-paristech.fr> wrote:

>
> 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 (only with access methods size, vec_get, and
> constructors)
> - 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.girard at 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
>
> Le lien vaut mieux que le bien.
> ________________________________________________________
>
> CONFIDENTIALITY : This  e-mail  and  any attachments are
> confidential and may be privileged. If  you are not a
> named recipient, please notify the sender immediately and
> do not disclose the contents to another person, use it for
> any purpose or store or copy the information in any medium.
>
> CONFIDENTIALITE : Ce message et les éventuelles pièces
> attachées sontconfidentiels et peuvent être une
> communication protégée. Si vous n'êtes pas dans la liste
> des destinataires, veuillez informer l'expéditeur
> immédiatement et ne pas ouvrir ni divulguer le contenu
> à une tierce personne, ne pas l'utiliser pour quelque
> raison que ce soit, ne pas stocker ou copier l'information
> qu'il contient sur un quelconque support.
>
> _______________________________________________
> 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




-- 
Ahmadou H. DICKO
Data scientist and applied economist
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130402/fd3f092c/attachment.html>


More information about the Rcpp-devel mailing list