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

2013-04-04 Thread Dirk Eddelbuettel
On 4 April 2013 at 12:45, Krzysztof Sakrejda wrote: | I realize you did not ask for book suggestions, but a gentle walk | through all these C++ issues (Slicing, constructors/destructors, and | the joy of pointers) is contained in Koenig & Moo's "Accelerated C++: | practical programming by example.

[Rcpp-devel] Persistent C++ objects in R ( tree data structure )

2013-04-04 Thread Ariful Azad
Hello Everybody, I am trying to create tree data structure using C++ and Rcpp and use it from R. I want to incrementally build the tree by merging a tree with other tress. So, I created a class for the tree and a class for the nodes in the tree. The tree class has two constructors, the first one s

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

2013-04-04 Thread Krzysztof Sakrejda
On Thu, Apr 4, 2013 at 12:10 PM, Robin Girard wrote: > but when I do > > res=new("Rcpp_vector_Of_father",1:10) > res[[1]]$WhoAmI() > res[[0]]$WhoAmI() > > rm(res) > gc() > > that crashes with gc() Dear Robin, I realize you did not ask for book suggestions, but a gentle walk through all these C++

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

2013-04-04 Thread Romain Francois
Le 04/04/13 18:10, Robin Girard a écrit : but when I do res=new("Rcpp_vector_Of_father",1:10) res[[1]]$WhoAmI() res[[0]]$WhoAmI() rm(res) gc() that crashes with gc() R. Yes. That is the sort of things you need to worry about. when you do res[[1]], you call this father* vec_get( int i) { re

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

2013-04-04 Thread Robin Girard
but when I do res=new("Rcpp_vector_Of_father",1:10) res[[1]]$WhoAmI() res[[0]]$WhoAmI() rm(res) gc() that crashes with gc() R. - Mail original - De: "Robin Girard" À: "Romain Francois" Cc: [email protected] Envoyé: Jeudi 4 Avril 2013 18:08:50 Objet: Re: [Rcpp-d

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

2013-04-04 Thread Robin Girard
that works indeed :) R. - Mail original - De: "Romain Francois" À: "Robin Girard" Cc: [email protected] Envoyé: Jeudi 4 Avril 2013 17:58:42 Objet: Re: [Rcpp-devel] Module with vector of a class with inheritance, how to avoid slicing Le 04/04/13 17:34, Robin Gi

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

2013-04-04 Thread Romain Francois
Le 04/04/13 17:34, Robin Girard a écrit : Thanks a lot Romain ! you're amazingly fast and furious (got my seatbelt). I'll definitely buy the book. That works on my example, I confirm (I had a side problem with using _t which I removed but don't see where this comes from, my side for sure). No

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

2013-04-04 Thread Robin Girard
Thanks a lot Romain ! you're amazingly fast and furious (got my seatbelt). I'll definitely buy the book. That works on my example, I confirm (I had a side problem with using _t which I removed but don't see where this comes from, my side for sure). Now I'm trying to implement it on my "real w