Dear all, I have another one of my stupid questions. Suppose that for any reason I want to define my own vector class like this:
@@@@@@@@@@@@@@@@@ template<typename T> struct Vec { T* ptr; int len; }; @@@@@@@@@@@@@@@@@ so, without owning memory but just pointing to some (hopefully valid) area of memory. How can I extend Rcpp with this class so that I can have R vectors automatically converted to these vectors? The obvious answer is "read "extending Rcpp" instead of bothering us", and I did it, and I tried the following: @@@@@@@@@@@@@@@@@ #include <RcppCommon.h> template<typename T> struct Vec { T* ptr; int len; Vec(SEXP x){ if (TYPEOF(x) != Rcpp::traits::r_sexptype_traits<T>::rtype) Rcpp::stop("incompatible types"); Rcpp::Vector< Rcpp::traits::r_sexptype_traits<T>::rtype > rcpp_vec(x); ptr = rcpp_vec.begin(); len = rcpp_vec.length(); } }; #include <Rcpp.h> blablabla @@@@@@@@@@@@@@@@@ but the compiler complains and says: error: 'Vector' is not a member of 'Rcpp' this is probably because I still did not import Rcpp.h, but in "extending Rcpp" they say to include Rcpp.h only after defining my classes, so how should I do? Thanks in advance! Ale -- Alessandro Mammana, PhD Student Max Planck Institute for Molecular Genetics Ihnestraße 63-73 D-14195 Berlin, Germany _______________________________________________ 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