首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::unordered_map::reserve

void reserve( size_type count );

(since C++11)

将桶数设置为至少容纳所需的数量。count元素而不超过最大负载因子并重新散列容器,也就是说,考虑到容器的总数量发生了变化,将元素放入适当的桶中。有效呼叫rehash(std::ceil(count / max_load_factor()))...

参数

count

-

new capacity of the container

返回值

%280%29

复杂性

平均情况线性在容器的大小,最坏的情况是二次型的。

另见

rehash

reserves at least the specified number of buckets.This regenerates the hash table. (public member function)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券