powered by
Shrink the capacity of a container to its size by reference.
shrink_to_fit(x)
Invisibly returns NULL.
NULL
A CppVector or CppDeque object.
The capacity is the space, in terms of the number of elements, reserved for a container. The size is the number of elements in the container.
capacity, reserve, size.
v <- cpp_vector(4:6) capacity(v) # [1] 3 reserve(v, 10) capacity(v) # [1] 10 shrink_to_fit(v) capacity(v) # [1] 3
Run the code above in your browser using DataLab