I think that you are mistaken about the semantics of the Get_region
method. It should actually copy the region elements to the 'out'
buffer. For example, the Get_region method for stdvec_double should
be something like:
static R_xlen_t Get_region(SEXP vec, R_xlen_t start, R_xlen_t size, double* out){
R_xlen_t len = Get(vec).size() - start;
if (len>size)
{
len = size;
}
for (R_xlen_t i=0; i<len; ++i)
{
out[i] = Get(vec)[start+i];
}
return len;
}
You probably didn't notice this because Get_region is not called
during operations like printing 'x' (the object returned by
'doubles()'), or 'str(x)' in R.
I think that you are mistaken about the semantics of the Get_region method. It should actually copy the region elements to the 'out' buffer. For example, the Get_region method for stdvec_double should be something like:
You probably didn't notice this because Get_region is not called during operations like printing 'x' (the object returned by 'doubles()'), or 'str(x)' in R.