简体   繁体   English

向量中的大小 (C++)

[英]Size in Vectors (C++)

In C++, using vectors (STL) does size() ALWAYS return the correct amount OCCUPIED elements in a vector?在 C++ 中,使用向量 (STL) size() 是否总是在向量中返回正确数量的 OCCUPIED 元素?

I checked this: https://www.geeksforgeeks.org/vector-in-cpp-stl/我查了一下: https : //www.geeksforgeeks.org/vector-in-cpp-stl/

Yes, that is what size() is specifically for.是的,这就是size()专门用于的。

From your link:从您的链接:

size() – Returns the number of elements in the vector. size() – 返回向量中的元素数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM