Re: [Rcpp-devel] Preferred idiom for obtaining a pointer in Rcpp

2010-03-16 Thread Romain Francois
Le 16/03/10 01:33, Douglas Bates a écrit : > > I have been using the begin method to obtain a pointer to the contents > of an Rcpp::Vector object. For example > > Rcpp::NumericVector foo(10); > double *ptr = foo.begin(); > > Would a preferred idiom be > > double *ptr =&foo[0]: > > In C I would use

Re: [Rcpp-devel] Preferred idiom for obtaining a pointer in Rcpp

2010-03-15 Thread Dirk Eddelbuettel
On 15 March 2010 at 21:10, Dirk Eddelbuettel wrote: | The classes are meant to be somewhat opaque and you're really supposed to | poke in like that even when it works. A "not" went missing there... Dirk -- Registration is open for the 2nd International conference R / Finance 2010 See http:

Re: [Rcpp-devel] Preferred idiom for obtaining a pointer in Rcpp

2010-03-15 Thread Dirk Eddelbuettel
On 15 March 2010 at 19:33, Douglas Bates wrote: | I have been using the begin method to obtain a pointer to the contents | of an Rcpp::Vector object. For example | | Rcpp::NumericVector foo(10); | double *ptr = foo.begin(); I use that form. And we have gotten fond of the begin() notion which op

[Rcpp-devel] Preferred idiom for obtaining a pointer in Rcpp

2010-03-15 Thread Douglas Bates
I have been using the begin method to obtain a pointer to the contents of an Rcpp::Vector object. For example Rcpp::NumericVector foo(10); double *ptr = foo.begin(); Would a preferred idiom be double *ptr = &foo[0]: In C I would use the REAL function to obtain a pointer to the contents of the