DO NOT DO THIS!!! SETLENGTH and SET_TRUELENGTH are NOT part of the API
and are for internal use only.
Tho proper way to do this is to copy the data you want into a smaller
vector and allow the larger one to be garbage collected.
[VECSXPs are like all other vectors in that they are contigously
al
Dear all,
I want to create a function shrinkVector(x) that takes x and truncates
it to the first element without copy.
With SETLENGTH and SET_TRUELENGTH, I can achieve that. You can find a
reproducible example below.
But the memory that was freed is not available for other objects
afterwards,