![](/img/trans.png)
[英]Retrieve pointer that can acess all the elements of arrays stored in a std::vector
[英]Max no. of elements that can be stored in the std::vector<int>
由於我們可以在數組中存儲 10^7 個元素,如果我們需要存儲 >= 10^9 的元素,那么我們該怎么做呢?
最大編號可以存儲在 std::vector 中的元素
取決於運行程序的系統的限制。 在 64 位系統上,最大值很可能受到系統可用的物理 memory 數量的限制。
如果我們需要存儲元素 >= 10^9 那么我們該怎么做呢?
然后調用vec.resize(1'000'000'000)
。 這還不到 4 GB 的 memory(在典型系統上)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.