Re: [Rd] What is the best way to loop over an ALTREP vector?

2019-09-23 Thread Gabriel Becker
Hi Bob, Thanks for sending around the link to that. It looks mostly right and looks like a useful onramp. There are a few things to watch out for though (I've cc'ed Romain so he's aware of these comments). @romain I hope you taake the following comments as they are intended, as help rather than at

Re: [Rd] What is the best way to loop over an ALTREP vector?

2019-09-23 Thread Bob Rudis
Not sure if you're using just C++ or Rcpp for C++ access but https://purrple.cat/blog/2018/10/14/altrep-and-cpp/ has some tips on using C++ w/ALTREP. > On Sep 23, 2019, at 3:17 PM, Wang Jiefei wrote: > > Sorry for post a lot of things, for the first part of code, I copied my C++ > iter macro b

Re: [Rd] What is the best way to loop over an ALTREP vector?

2019-09-23 Thread Wang Jiefei
Sorry for post a lot of things, for the first part of code, I copied my C++ iter macro by mistake(and you can see an explicit type casting). Here is the macro definition from R_exts/Itermacros.h #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ st

Re: [Rd] What is the best way to loop over an ALTREP vector?

2019-09-23 Thread Wang Jiefei
Hi Gabriel, I have tried the macro and found a small issue, it seems like the macro is written in C and does an implicit type conversion(const void * to const int *), see below. While it is allowed in C, C++ seems not happy with it. Is it possible to add an explicit type casting so that it can be