shrink_to_fit {cppcontainers} | R Documentation |
Shrink container capacity to size
Description
Shrink the capacity of a container to its size by reference.
Usage
shrink_to_fit(x)
Arguments
x |
A CppVector or CppDeque object. |
Details
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.
Value
Invisibly returns NULL
.
See Also
Examples
v <- cpp_vector(4:6)
capacity(v)
# [1] 3
reserve(v, 10)
capacity(v)
# [1] 10
shrink_to_fit(v)
capacity(v)
# [1] 3
[Package cppcontainers version 1.0.0 Index]