Displaying 1 result from an estimated 1 matches for "push_back_integer".
2003 Dec 10
0
C++: SET_LENGTH() Over Many Iterations?
...esn't happen when I pre-allocate the R-vector memory and write
to the reserved slots; i.e., I'm not trying to create an R object too
big to be handled by R within the context of my OS's available memory.
Here's some simple test code I've been running:
<CPP Code>
#define PUSH_BACK_INTEGER(v, x) \
do {\
UNPROTECT_PTR(v);\
SET_LENGTH(v, GET_LENGTH(v) + 1);\
PROTECT(v);\
INTEGER_POINTER(v)[GET_LENGTH(v) - 1] = x;\
}\
while (false)
SEXP R_SimplePushBackTest(SEXP args)
{
SEXP arg1, arg2, int_vect;
PROTECT(arg1 = AS_INTEGER(CADR(args)));...