| reserve | R Documentation |
Reserve space for the container by reference.
reserve(x, n)
x |
A CppUnorderedSet, CppUnorderedMultiset, CppUnorderedMap, CppUnorderedMultimap, or CppVector object. |
n |
The minimum number of elements per bucket. |
In case of a CppUnorderedSet, CppUnorderedMultiset, CppUnorderedMap, CppUnorderedMultimap, the method sets the number of buckets to be able to
hold at least n elements and rehashes. In case of a CppVector, the method sets the capacity to n.
Invisibly returns NULL.
bucket_count, capacity, load_factor, max_bucket_count, max_load_factor.
s <- cpp_unordered_set(4:6)
bucket_count(s)
# [1] 13
reserve(s, 3)
bucket_count(s)
# [1] 5
v <- cpp_vector(4:6)
capacity(v)
# [1] 3
reserve(v, 10)
capacity(v)
# [1] 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.