Quantcast
Channel: How can I get the size of an std::vector as an int? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Jessica Young for How can I get the size of an std::vector as an int?

Easy :) Use the following code instead of your code.auto size = v.size();

View Article



Answer by Baum mit Augen for How can I get the size of an std::vector as an int?

In the first two cases, you simply forgot to actually call the member function (!, it's not a value) std::vector<int>::size like this:#include <vector>int main () { std::vector<int>...

View Article

How can I get the size of an std::vector as an int?

I tried:#include <vector>int main () { std::vector<int> v; int size = v.size;}but got the error:cannot convert 'std::vector<int>::size' from type 'std::vector<int>::size_type...

View Article
Browsing all 3 articles
Browse latest View live


Latest Images