| capacity | R Documentation |
Get the capacity of a CppVector.
capacity(x)
x |
A CppVector object. |
The capacity is the space reserved for the vector, which can exceed its size. Additional capacity ensures that the vector can be extended efficiently, without having to reallocate its current elements to a new memory location.
Returns a numeric.
reserve, shrink_to_fit, size.
v <- cpp_vector(4:9)
v
# 4 5 6 7 8 9
capacity(v)
# [1] 6
reserve(v, 20)
size(v)
#[1] 6
capacity(v)
# [1] 20
v
# 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.