简体   繁体   中英

Size in Vectors (C++)

In C++, using vectors (STL) does size() ALWAYS return the correct amount OCCUPIED elements in a vector?

I checked this: https://www.geeksforgeeks.org/vector-in-cpp-stl/

Yes, that is what size() is specifically for.

From your link:

size() – Returns the number of elements in the vector.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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