Hi All,

Thanks to Dirk Eddelbuettel and the other contributors for such a
wonderful package. Rcpp really transforms the way that I've been able to
incorporate c++ code into R. Makes it possible to speed up the critical
computations while keeping all the great flexibility and features of R.

I've run into a problem lately with particularly large vectors in Rcpp. I
seem to be overflowing when my vectors get larger than 2^31 elements on a
64 bit system. It looks from the code of both the classic (included below)
and the newer versions as though this is due to using ints rather than
something like size_t (http://en.wikipedia.org/wiki/Size_t) as the type for
size and indexing into the vector. It looks like RcppResultsSet's add()
functions may also be using ints.

Curious to know if there is a particular reason for using ints rather than
something like size_t and if the project managers would be open to changing
to accomodate larger vectors.

Thanks,
-Chuck Sugnet

template <typename T>
class RcppVector {
public:
        typedef T* iterator ;
        typedef const T* const_iterator ;
        
    RcppVector(SEXP vec);
    RcppVector(int len);
    int size() const;
    T& operator()(int i) const; 
    T *cVector() const;
    std::vector<T> stlVector() const;
    
    inline const_iterator begin() const { return v ; }
    inline const_iterator end() const { return v + len ; }
    
    inline iterator begin(){ return v ; }
    inline iterator end(){ return v + len ; }
    
private:
    int len;
    T *v;
};
_______________________________________________
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