[Rcpp-devel] Patch: MatrixRow::iterator post-incr and -decr

Romain Francois romain at r-enthusiasts.com
Fri Feb 1 13:58:19 CET 2013

Le 01/02/13 11:44, North, Ben a écrit :
> Hi,
> I was having trouble iterating through the elements of a MatrixRow, and
> tracked it down to the following, which I think is a bug in Rcpp.
> The post-increment and post-decrement operators within
> MatrixRow::iterator currently return the new state of the iterator,
> whereas they should return the original state.  The attached patch
> (against 0.10.2, including new unit test) fixes this for me.
> Could somebody review and apply if approved please?
> Thanks very much, and for the continuing work on Rcpp --- it's a great
> tool.
> Ben.


I can't believe we have not seen this before, but your patch seems right.

I'll commit something similar, as I believe this also means that all our 
operator++(int) are wrong.


Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://romainfrancois.blog.free.fr
|- http://bit.ly/RE6sYH : OOP with Rcpp modules
`- http://bit.ly/Thw7IK : Rcpp modules more flexible

More information about the Rcpp-devel mailing list