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

2013-02-01 Thread North, Ben
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 o

Re: [Rcpp-devel] Odd-seeming behaviour of [[ and $

2012-10-23 Thread North, Ben
Hi Romain, > > Because `$` doesn't evaluate its field-name argument, is > > > > field.name <- "value" > > do.call(`$`, list(x, field.name)) > > > > the recommended way of accessing methods whose names are computed at > > run-time? It does work; just wondering if there's a better way. >

Re: [Rcpp-devel] Odd-seeming behaviour of [[ and $

2012-10-22 Thread North, Ben
Hi Romain, Thanks for the reply. > > The fact that 'x[["value"]]' finds the method only if I've first done > > 'x$value' seemed odd. > > This is an implementation artefact. In short, you are not supposed to > use [[. OK, fair enough :) Because `$` doesn't evaluate its field-name argument, is

[Rcpp-devel] Odd-seeming behaviour of [[ and $

2012-10-22 Thread North, Ben
Hi, I recently came across some behaviour of `[[` and `$` which surprised me. I was trying to access a method of a class implemented using Rcpp, choosing the method name at runtime, but the example below uses a fixed method name to keep it short. The full C++ code: - - - - 8< - - - - #include

Re: [Rcpp-devel] Missing PROTECT()s in forward_exception_to_r()?

2012-10-09 Thread North, Ben
> For completeness, the current version of exceptions.cpp is here > https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/src/exceptions.cpp?view=markup&root=rcpp Ah yes; I hadn't made the corresponding changes in the other places. Thanks. Susquehanna Internation

Re: [Rcpp-devel] Missing PROTECT()s in forward_exception_to_r()?

2012-10-09 Thread North, Ben
Hi Dirk, Douglas, Many thanks for your time in digging into this. I did some further experiments yesterday and cut down the PROTECT()s a bit, but your version below is much tidier. I confirm that your suggested code SEXP cppExceptExpr = PROTECT(Rf_lang3(cppExceptSym,

[Rcpp-devel] Missing PROTECT()s in forward_exception_to_r()?

2012-10-08 Thread North, Ben
Hi, I've been using Rcpp for a while now, and finding it very useful --- thanks! Recently, though, I came across strange behaviour when running under gctorture(TRUE) and C++ exceptions were being forwarded to R. The error message string at the R level was some essentially random pathname, and th